3 ms·
I'd love to get HN feedback on a library I wrote to make SQL more manageable - https://github.com/hashedin/jinjasql https://github.com/hashedin/jinjasql. The l
by ksri 10y ago
I'd love to get HN feedback on a library I wrote to make SQL more manageable - https://github.com/hashedin/jinjasql https://github.com/hashedin/jinjasql.
The library is built on the Jinja template engine. You can create macros, functions and other reusable sql fragments, and then use them to create the query. You can also write loops and conditionals, so you can do all the things you routinely do to generate HTML.
The library tracks bind parameters, and doesn't let user input into the query. At the end of the day, you get the generated SQL and an array of bind parameters. You can use these two to execute the query using whatever database & driver combination you like.