6 ms·
I guess it's more clear that it should be a to statically readable value? eg you shouldn't do things like use arguments to build the str
by duncanfwalker 10mo ago
I guess it's more clear that it should be a to statically readable value? eg you shouldn't do things like use arguments to build the str
- jcz_nz 10mo agoI 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 10mo 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 10mo 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.