using logging is the most direct way, however if you want to programmatically intercept all SQL you can use before_cursor_execute: https://docs.sqlalchemy.org/en/14/core/events.html#sqlalchemy.events.ConnectionEvents.before_cursor_execute
On Thursday, December 8, 2022 at 9:31:56 AM UTC-5 yahme...@gmail.com wrote: > how to get *raw* query of each *sqlalchemy session orm* in db file: > for example in db.py file > > the raw of the executing query has to be taken > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/fd1c5620-36d2-46f3-a208-7be7ff9c5fecn%40googlegroups.com.