Hi, For Pyramid, another interesting package is SQLTap, which provides useful informations about execution of SQLAlchemy queries...
Best regards, Thierry 2016-10-31 11:05 GMT+01:00 Simon King <si...@simonking.org.uk>: > On Sun, Oct 30, 2016 at 9:36 PM, Alfred Perlstein > <alfred.perlst...@gmail.com> wrote: > > 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 > > Hi Alfred, > > That looks very interesting, and I'd actually like to be able to use > it in my applications. Unfortunately I usually use pyramid rather than > flask, and this is obviously very flask-specific. > > I wonder if it could be split into 2 parts. The first would be a > framework-agnostic class for tracking and logging queries and so on, > and the second would be an adapter that hooks the class into a flask > application. It should then be easy to write adapters for other > frameworks as needed. > > Simon > > -- > 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. > -- http://www.imagesdusport.com -- http://www.ztfy.org -- 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.