News for hackers. Stuff that matters.
Re:Show HN: JinjaSQL – Generate SQL Queries using a Jinja Te... by anshum4n on Tuesday November 08, 2016 @01:07AM (#12898052)
Would be great if you can put in some examples where we can optimise parametric queries using this. One common instance is IN queries where if the number of params for IN clause is small, it might make sense to blow it up into multiple equals clauses, allowing better use of indexes. MySQL query optimiser is horrible with IN clauses and causes table-scans. I have seen table scans and skipping other indexes even when IN clause has zero cardinality (in which case its better to just remove it altogether).

Couldn't immediately think of other cases, but that one example sounds useful for this.

Re:Show HN: JinjaSQL – Generate SQL Queries using a Jinja Te... by ksri on Wednesday November 09, 2016 @10:41AM (#12910955)
In clauses are blown up. I have now added that to the documentation - see https://github.com/hashedin/jinjasql#handling-in-clauses

Skipping in clauses altogether - for now, you can handle that using an if condition.