I want to see the SQL code instead of doing an actual db.commit(). This is for a one-off database population script that I want to verify is working as intended before actually making the changes.
Asked
Active
Viewed 1,399 times
3
-
Sir, you have the answer? – Ferid Š. Sejdović Feb 02 '21 at 17:59
1 Answers
4
Try calling str() on the query object.
print query_object.str()
From:
How do I get a raw, compiled SQL query from a SQLAlchemy expression?
Other possible solutions:
The newest (as of v0.9) answer is also: