On Nov 20, 6:20 pm, Empty <[EMAIL PROTECTED]> wrote: > > Different, but related question: How do I print out the statement in > > "copy-paste-able" format? More specifically, how do i get an ordered > > list of bound values out of the statement? > > > This code does what I want, but it's really clunky and fragile: > > > def print_statement(stmt): > > s = str(stmt).replace("?", "%s") > > from re import search > > args = search("\((.*?)\)", s).group(1).split(", ") > > print s % tuple(repr(stmt.params[arg]) for arg in args) > > > There's also a UsageRecipe for this: > >http://www.sqlalchemy.org/trac/wiki/DebugInlineParams > > Michael
Thanks! That was exactly what I was looking for. I tried to dig though the dialects and compilers and everything to figure this out, but after a few hours, no success. It would be great if we had a sqlalchemy utility to print out our statements in an expanded way. Yes, it's unsafe, but it's pretty essential for debugging. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---