JinjaSQL – Templating Language to Generate SQL Statements
github.com
github.com
But generating dynamic SQL by hand is error prone and has lot of repetition, especially when your query grows big.
JinjaSQL gives you the flexibility of a template language (Jinja), without having to manually track your bind parameters. It's not a replacement for an ORM, but is meant for those 10-20% use cases that require the power of SQL.