pythonponyorm

How do I see the SQL that ponyorm generates?


In this example:

with db_session:
    p = select(_ for _ in Person in _.name == 'John')[:][0]

I need this for debugging purposes, since I would like to see the SQL it generates to a similar query in other ORMs.


Solution

  • One can use pony.orm.sql_debug(True). This will show you all the SQL that pony generates whenever one is in a transaction. Debugging SQL in Pony