You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JinjaSQL is not meant to replace your ORM. ORMs like those provided by SQLAlchemy or Django are great for a variety of use cases, and should be the default in most cases. But there are a few use cases where you really need the power of SQL.
Use JinjaSQL for -
Reporting, business intelligence or dashboard like use cases
When you need aggregation/group by
Use cases that require data from multiple tables
Migration scripts & bulk updates that would benefit from macros
In all other use cases, you should reach to your ORM instead of writing SQL/JinjaSQL.
It would be good to know why this would be better than SQLAlchemy (I'm less familiar with Django's ORM) - some examples: SQLAlchemy has Group By support, you can get data from multiple tables using it, and you can dynamically build queries using it. Also it has the core API as a lower level SQL DSL.
Thanks!
The text was updated successfully, but these errors were encountered:
Yes, SQLAlchemy is great. In general, if your use case can be met with SQLAlchemy core, then you really should use it.
There are times when a report or a transformation needs significantly complex queries. You want to incrementally work on the query, look at performance, make tweaks and so on. Once you have the final working query - it is much simpler to put into a JinjaSQL template, than to take that monstrosity and convert it into equivalent SQLAlchemy core.
Just based on this section:
It would be good to know why this would be better than SQLAlchemy (I'm less familiar with Django's ORM) - some examples: SQLAlchemy has Group By support, you can get data from multiple tables using it, and you can dynamically build queries using it. Also it has the core API as a lower level SQL DSL.
Thanks!
The text was updated successfully, but these errors were encountered: