|
|
|
|
|
by aforwardslash
1178 days ago
|
|
There is a subtle difference between "can't be done" or "I'll spend an afternoon digging through documentations, code & examples to implement this". Quick obvious example - use views for data retrieval (that may contain more fields than the actual model) and tables for data insertion. |
|
Though if you are working with views and not materialized views, performance wise "use .annotate when fetching data" will be roughly as performant as using a view. Views just end up getting swapped out when the planner deals with the query (in Postgres at least).
Of course I get this cuz I spent a lot of time with the ORM. I think it's easy for people to think "there must be a magic option somewhere in the ORM to do this", but sometimes there's no magic. The counterpoint, though, is you have Python behind all of this so stuff like "share schema definitions between classes" is easy and straightforward in my experience (including on projects with like...80+ models, some with way too many fields, so I get your pain). It might not be the exact API you want though