Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask SQLAlchemy display queries for debug

I am developing an app with flask and SQL Alchemy. I need to display the queries executed to generate a page alongside the time each query took for debugging

What's the best way to do it?

like image 823
applechief Avatar asked Sep 11 '12 12:09

applechief


2 Answers

If you're using the Flask-SQLAlchemy extension and don't want to bother with create_engine, you can set the configuration key SQLALCHEMY_ECHO=True.

http://flask-sqlalchemy.pocoo.org/2.1/config/

like image 170
Cawb07 Avatar answered Sep 22 '22 01:09

Cawb07


app.config['SQLALCHEMY_ECHO'] = True
like image 42
Peter Cotton Avatar answered Sep 19 '22 01:09

Peter Cotton