3

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.

wuxiekeji
  • 1,772
  • 2
  • 15
  • 22

1 Answers1

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:

Community
  • 1
  • 1
chishaku
  • 4,577
  • 3
  • 25
  • 33