4 ms·
I would def use this if there was a return “select …” option. There are heaps of scenarios where sql is modified based on parameters. If no doc string just use
by jcz_nz 11mo ago
I would def use this if there was a return “select …” option. There are heaps of scenarios where sql is modified based on parameters. If no doc string just use the return value maybe?
Our queries are typically large, not 3-5 liners.
(Filter view queries where you might add additional CTA’s to provide the necessary filter conditions, but aren’t desirable if particular filter parameter is nill, etc.)
- emixam 11mo agoHello, author here. It is actually possible to use return instead with a different set of decorators: check out the first "tip" block on this page: https://hyperflask.github.io/sqlorm/sql-functions/ https://hyperflask.github.io/sqlorm/sql-functions/
- tcdent 11mo agoJust keep in mind best practice is to use the built-in parameter interpolation that comes with your db library, since it handles escaping SQL injection for you. Be very careful if you ever use bare string formatting to construct your queries.