nicer stringify query feature? e.g. for unhandled bound parameters
On IRC, one of the most frequently asked question is this one: it would be nice if it could be integrated with the more advanced technique depicted on StackOverflow, with a particular mention of the function visitors.replacement_traverse()
.
Comments (4)
-
repo owner -
reporter Ok, reasonable.
As another use case of this: I wrote a Sphinx extension that extracts and pretty prints canned queries from the Python sources; with some dirty hack it tries to replace the implicit bindparams that SA uses to render (say)
table.c.foo == "bar"
, while leaving the explicitbindparams()
coded by the developer in place.I don't know if the new stringify_param_fallback feature you mentioned could cover that too, but it would be nice I could remove that regexp-based black magic...
-
repo owner OK you want an is_anonymous flag on BindParameter, that's not hard.
-
repo owner - changed milestone to 1.3
- changed component to sql
- changed title to nicer stringify query feature? e.g. for unhandled bound parameters
- Log in to comment
OK but the visitors.replacement_traverse() solution was a "works right now" thing for stack overflow. That should not be the approach the main documentation endorses. for the main docs we'd need to add a new feature like compile_kwargs={"stringify_param_fallback": my_custom_function()}, or something like that.