Skip to content

Conversation

dtheodor
Copy link

This is an attempt to fix #71.

It adds a new argument sqlalchemy_engine to DebugToolbarExtension(app, sqlalchemy_engine=None). If no engine is passed, the old behavior is maintained. If an engine is passed, then the query recording events are installed on that engine and no flask-sqlalchemy db is touched. The event registration still uses flask-sqlalchemy code.

This still requires flask-sqlalchemy to be installed in order to record queries, but it does not require the user to use it to declare models and query for data; raw sqlalchemy engines and tables can be used instead. I added a basic app example that uses plain sql alchemy under basic_app_raw_sqlalchemy.py

DebugToolbar can receive an sql alchemy engine explicitly, in
which case it will install engine events that record queries.
Otherwise, it falls back to old Flask-SQLAlchemy behavior.
@a-urth
Copy link

a-urth commented Apr 11, 2015

What about this request? Does actually this extension is maintained by someone?
Me also highly interested in debug toolbar without flask sqlalchemy.

@mgood
Copy link
Contributor

mgood commented Apr 13, 2015

Sorry, yes I've been rather behind on the maintenance of this project. I'll follow up on the original issue #71 with some thoughts on this.

@kxxoling
Copy link

Would be great to support raw SQLAlchemy. I have a app built on Flask for web and Tornado for IM and push service, and I reused the model layer on raw SQLAlchemy.
Would be nice to hear raw SQLAlchemy support!

@eMerzh
Copy link

eMerzh commented Sep 18, 2016

any news of this front ?
something needed to be fixed for the review ?

@illume
Copy link

illume commented Feb 10, 2017

There's a conflict now.

@jeffwidman
Copy link
Member

I would like to add support for raw SQLAlchemy here. It's been a while since this was looked at though, so I'm not sure what changes are needed... @dtheodor do you mind rebasing to fix merge conflicts so we get a clean slate for testing/discussing the actual implementation?

@josegonzalez
Copy link

For anyone that wants this sort of functionality, a separate python module exists called fdt-sqlalchemy. It has a bug where there is an errant print, which I've removed and documented a workaround for here.

@macnewbold
Copy link
Contributor

I know it's been a long time, but do you still have any interest in this?
If so, it will need to catch it up with master and retest. If not, we'll probably close it out.
Is it safe to say this one should be superseded by #110 ?

@macnewbold macnewbold closed this Feb 19, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

Raw Sqlalchemy
9 participants