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

Add config flag for SQLAlchemy vs. Flask-SQLAlchemy Extension #161

Open akcode47 opened 2 years ago

akcode47 commented 2 years ago

Achieved it this way, but it would be nice if there was an option within flask-debugtoolbar to toggle the use between the two:

# https://pypi.org/project/flask-debugtoolbar-sqlalchemy/
# https://git.sr.ht/~ihabunek/flask_debugtoolbar_sqlalchemy/tree/master

# Remove the Flask-SQLAlchemy Extension specific SQLAlchemyDebugPanel and Replace with SQLAlchemyPanel

app.config['DEBUG_TB_PANELS'] = tuple(
      list(
            map(
                  lambda x: x.replace(
                        'flask_debugtoolbar.panels.sqlalchemy.SQLAlchemyDebugPanel',                                                                         
                        'flask_debugtoolbar_sqlalchemy.SQLAlchemyPanel'
                  ), 
                  list(
                        app.config['DEBUG_TB_PANELS']
                  )
            )
      )
)