Re:Show HN: JinjaSQL – Generate SQL Queries using a Jinja Te...
by traviscj on Friday November 04, 2016 @08:54AM
(#12872151)
My favorite trick is binding a hook in unit test modules that basically runs an "explain q" for every query "q", and asserts that it found an appropriate index to use. Then as long as your unit tests exercise all queries your app needs, you know that your database indices are appropriate for your app's usages.
Re:Show HN: JinjaSQL – Generate SQL Queries using a Jinja Te...
by Can_Not on Friday November 04, 2016 @08:28PM
(#12877383)
I wish laravel had this and an automated SQL debug comment feature.
Re:Show HN: JinjaSQL – Generate SQL Queries using a Jinja Te...
by svisser on Friday November 04, 2016 @11:32AM
(#12873357)
> In the long run, for readability and maintainability, ORMs win most of the time.
It depends. Anyone working on that code now needs to learn the ORM, the SQL and how to let the ORM generate that SQL for anything beyond the basics.
The few times when I do need to force a certain SQL syntax that the ORM won't give me, I drop down to SQL. But doing that doesn't magically make all queries faster.