News for hackers. Stuff that matters.
Re:Simple SQL in Python by krick on Thursday August 13, 2020 @02:25PM (#24146502)
Looks kinda nice, but can it handle "IN (...)" statements correctly? Or conditionally adding some WHERE param? If not, this is rather simplistic and couldn't replace writing inline queries, and then I think I'd rather not mix together 2 approaches.
Re:Simple SQL in Python by munk-a on Thursday August 13, 2020 @05:05PM (#24149144)
I've built pre-parsing layers for queries that can explode out params properly for IN() handling - though depending on your SQL variant you can also get away with string passing an array to get around that.

Conditional WHERE seems unapproachable with this tool - which is one of my doubts about the need of a tool like this.

If you instead approach your SQL by having each query wrapped in a function in an isolated part of your code base you, as a company/team/whatever, can choose how much logic to let reside inside of those functions - building up conditional WHERE clauses is a very common thing to need to do.

Re:Simple SQL in Python by ksri on Thursday August 13, 2020 @10:31PM (#24152541)
Take a look at JinjaSQL (https://github.com/hashedin/jinjasql). Supports conditional where clauses as well as in statements. It uses Jinja templates, so you get a complete template language to create the queries.