Given a sqlalchemy query, display a well formatted and highlighted sql code.
pip install sqlalchemy-pretty-sql
And then just import the package in your IPython/Jupyter session
In[3]: import sqlalchemy_pretty_sql
In[4]: query
After sqlalchemy_pretty_sql
is imported, its pretty_sql
function
is registered to display the sql of any sqlalchemy.orm.query.Query
object.