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.

1
  • Sir, you have the answer? Commented Feb 2, 2021 at 17:59

1 Answer 1

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:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.