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,602
  • 2
  • 13
  • 20

1 Answers1

3

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,361
  • 3
  • 23
  • 32