| Thank you for your response! Very interested to understand if JinjaSQL could have made the following easier? I just prototyped a very expressive reporting API that takes database driven configurations for the reporting columns (dimensions and metrics), validates inputs and allows very expressive filtering (including partial string matches, etc.) in Flask and SQLAlchemy. Did not use the ORM part, but rather the query API: http://docs.sqlalchemy.org/en/latest/orm/query.html Queries included a with statement, the main query had 4 nested subqueries (4 level cascade basically) for ranking, filtering and ordering. The prototype supports queries like this: Give me best performing shows and their stats in my top 5 countries by the number of viewers I have in each of these top countries, but I want shows not broken down by country, but instead by season and episode, including counts of uniques at each level. (Sorry don't have a copy of the resulting SQL on this computer, but it's fairly long.) Queries I designed up front, and reverse engineered into being dynamically generated by SQLAlchemy query API. However, by not having a fixed template, I can simply update my reporting table configurations and not have to worry about updating the templates or the query structure. When the user requests something that does not have top dimension and topN results, I can just omit that part of the query and build valid syntax without it. All-in-all, the entire API is less than 1k lines of python. |
If you have a single complex query that is generating all your reports based on database configuration - I'm guessing you need the full power of python. So while JinjaSQL could have save some effort, I'm not sure it'd save you a lot.
Hope that helps!