0

I have two models in my API using FastAPI. Model 1: Deposits (id, created_at, updated_at, value) Model 2: Withdrawals(id, created_at, updated_at, value)

And I want to make an endpoint that returns the union of these two models as in SQL (one below the other). Something like: select id, created_at, updated_at, value from deposits union select id, created_at, updated_at, value from withdrawals

How to do this? Does anyone have any tutorials, examples or documentation to send me?

  • How about using `UNION` in your SQL query? It's impossible to say without you providing examples of what you're using and what you've tried. – MatsLindh Jun 19 '23 at 11:21
  • Multiple inheritance? Please provide some code. Show what you tried and what the results were. Show exactly what you _want_ the results to be instead. – Daniil Fajnberg Jun 19 '23 at 15:47

0 Answers0