Hello,

I wanted to start this out with a big thanks to the community, especially Mike Bayer, Simon King, and Jonathan Vanasco.

A few weeks ago I asked for help on debugging sqlalchemy and was able to use the combined feedback, tips, and tricks presented to build a handy little package for debugging flask+sqlalchemy.

The main goal was to get a handle on the number of queries being made by the orm and the latency involved.

I've just released the 0.2 version of a new package "flask_sqla_debug", you can find it on pypi (https://pypi.python.org/pypi/flask_sqla_debug) and github (https://github.com/splbio/flask_sqla_debug).

Right now it can:

1) turn on logging of sql statements for some blocks of code.

2) log/assert if a single query takes too long (~200ms).

3) log/assert if the combined queries inside of a request take too long (~200ms).

4) log/assert if the number of queries exceeds a threshold. (~20)

Most of these logs/asserts thresholds can be tuned per-endpoint, although there are handy defaults.

We are using it in our project now and finding all sorts of areas to optimize. It's been very handy just having it now for a week installed in our project.

To use it, just "pip install flask_sqla_debug" and then add this code to your flask app:

flask_app.flask_sql_debug = FlaskSqlaDebug(app=flask_app, engine=db.engine)

I'd love some feedback on features, documentation or anything else you have input on.

thanks again folks, this wouldn't have been possible without your help.

-Alfred

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to