Re:Show HN: SQueaLy – Fast track analytics for business
by sologoub on Thursday May 11, 2017 @02:11PM
(#14318213)
Thanks for the example, this helps a lot in my understanding of this!
It's pretty similar to what I did, but the template would be a lot more complex due to various column definitions and calculations, for example uniques require the base query to have the IDs of whatever I'm counting, but all in all I see the use case.
Re:Show HN: SQueaLy – Fast track analytics for business
by sheeshkebab on Thursday May 11, 2017 @02:22PM
(#14318292)
Is that safe from sqli prospective? It would inject table name and all, which I believe you can't bind...
Here's how you could write that in jinjasql. I'm writing this out of memory, and it has errors/issues - but I hope you get the idea.
This way, your template doesn't have to map to exactly one visualization.Now, another interesting this in the security aspect. You can also pass the logged in user data model, and then append a where clause that restricts the rows based on the logged in user id or his role or whatever else is your application security model.
I'm not sure how much effort it would have saved you, but it does help us a lot - mostly because we don't have to translate between SQL and the way SQL ALchemy / ORM works.