Skip to content

Instantly share code, notes, and snippets.

@dchaplinsky
Created November 5, 2014 19:03
Show Gist options
  • Save dchaplinsky/afe42623c7d4007b06f8 to your computer and use it in GitHub Desktop.
Save dchaplinsky/afe42623c7d4007b06f8 to your computer and use it in GitHub Desktop.
A neat way to print raw SQL for SQLAlchemy statement with dialect specific stuff and all params substituted.
from sqlalchemy.dialects import postgresql
print(YOUR_SQL.statement.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment