Re: [sqlalchemy] Turning a complex query into a view for SQLAlchemy?

2023-06-16 Thread Mike Bayer
SQLAlchemy has no intrinsic issue with views but the thing that goes wrong with views is that they perform very poorly when used with composition. that is, if you take your view and use in a subquery, do some GROUP BY on it, do some LEFT OUTER JOIN onto it, the performance plummets, because

[sqlalchemy] Turning a complex query into a view for SQLAlchemy?

2023-06-16 Thread Dan Stromberg
Hi. In https://pajhome.org.uk/blog/10_reasons_to_love_sqlalchemy.html it says: When performing highly complex queries, it is possible to define these with SQLAlchemy syntax. However, I find there's a certain level of complexity where it becomes easier to write SQL directly. In that case, you can