pallets-eco / flask-debugtoolbar

A toolbar overlay for debugging Flask applications
https://flask-debugtoolbar.readthedocs.io
BSD 3-Clause "New" or "Revised" License
953 stars 146 forks source link

SQLAlchemy 0 queries even for Flask-SQLAlchemy #78

Closed ducu closed 9 years ago

ducu commented 9 years ago

Anyone else experiencing this? Meanwhile I'll stick to SQLALCHEMY_ECHO = True, too bad, the toolbar is looking good and all other panels are working but I'm only interested in the queries.

mgood commented 9 years ago

Are you running the app in "debug" mode? (You can look for DEBUG in the Config panel.)

Flask-SQLAlchemy captures queries in debug mode by default, but if that is false, you'll need to also set the SQLALCHEMY_RECORD_QUERIES = True in your config. See: http://flask-sqlalchemy.pocoo.org/2.0/api/#flask.ext.sqlalchemy.get_debug_queries

I know that's not obvious, so I'm working on a patch that will display better help in the SQLAlchemy panel if it notices common problems that would prevent capturing the SQL queries.

If DEBUG or SQLALCHEMY_RECORD_QUERIES are true, then maybe this is a different issue, and I'd need a little more info to help debug.

mgood commented 9 years ago

I've pushed an update 61d1fc26786511c5142c55e5ccacfafe21cc666e that will detect common setup issues with Flask-SQLAlchemy and display steps to fix the query recording. I'm assuming you're just missing the SQLALCHEMY_RECORD_QUERIES, which this update will detect.

If you have another issue please reopen with more details.

ducu commented 9 years ago

Sorry but it doesn't work.. What info would you need to debug this?

screen shot 2015-04-18 at 15 46 39

iambibhas commented 8 years ago

Facing the same issue. SQLAlchemy - 0 queries. DEBUG is True.

Edit: I think setting SQLALCHEMY_RECORD_QUERIES = True made it work.