SQLAlchemy CSV exporting for pyramid_debugtoolbar
Project description
pyramid_debugtoolbar_api_sqlalchemy
pyramid_debugtoolbar_api_sqlalchemy extends the existing pyramid_debugtoolbar SQLAlchemy Panel to support downloadable CSV files of profiling data.
This package does not replace the default panel, and requires it to be active.
This package is designed for application profile and to be a useful part of test suites, allowing developers to run a series of tests and log the SQLAlchemy performance.
If you are using the debugtoolbar directly:
If SQLAlchemy queries exist on the request, a “SQLAlchemy CSV” tab will appear. That will prompt you for queries.
If you are scripting:
The urls are generated in a machine-friendly format, so you can regex the request_id off a page and pull it from the API. this is explained below:
NOTES:
This packages requires pyramid_debugtoolbar 4.0 or newer
How to use this package
Update your ENVIRONMENT.ini file
debugtoolbar.includes = pyramid_debugtoolbar_api_sqlalchemy
You MUST be using pyramid_debugtoolbar with the SQLAlchemy panel enabled. This just piggybacks on the existing module’s work to log queries.
You MUST use debugtoolbar.includes. This will not work properly via pyramid.includes
You can access a csv of the SQLAlchemy report via the following url hack:
url_html = '/_debug_toolbar/{request_id}'
url_api = '/_debug_toolbar/api-sqlalchemy/sqlalchemy-{request_id}.csv'
The file will be downloaded and offer a content-disposition as:
sqlalchemy-{request_id}.csv
The CSV columns are:
execution timing
SQLAlchemy query
query params (json encoded)
Configuration
By default, this package writes CSV files using “UTF-8” encoding.
To change this, use the environment variable pyramid_debugtoolbar_api_sqlalchemy_encoding
export pyramid_debugtoolbar_api_sqlalchemy_encoding=ascii
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for pyramid_debugtoolbar_api_sqlalchemy-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a99cbdfd1bceda79acc47250cd017c593f50fc9032a92a8e921ca791ff32503c |
|
MD5 | ca142aed2c107944efea5d781935301e |
|
BLAKE2b-256 | 5610981928c72fed362e79a7ce0e2ce9f467fcbcff3f16b7e1e6321ca2721cc8 |