getting raw of the query

14 views
Skip to first unread message

Yusufjon Ahmedov

unread,
Dec 8, 2022, 9:31:56 AM12/8/22
to sqlalchemy
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 

Michael Bayer

unread,
Jan 4, 2023, 7:17:34 PM1/4/23
to sqlalchemy
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
Reply all
Reply to author
Forward
0 new messages