nicer stringify query feature? e.g. for unhandled bound parameters

Issue #4024 new
Lele Gaifax
created an issue

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 (5)

  1. Michael Bayer repo owner

    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.

  2. Lele Gaifax 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 explicit bindparams() 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... 😃

  3. Log in to comment