A libray for use with SQLAlchemy to count queires, log queries, etc...
Project description
DBInspector
A Python context manager for use with SQLAlchemy.
Features
- Count the number of queires issued.
- Capture/print the statements/queries issued.
Installation
pip install dbinspector
Usage
with DBInspector(conn) as inspector:
conn.execute("SELECT 1")
conn.execute("SELECT 1")
# Get query count
assert inspector.get_count() == 2
# Print queries issued
inspector.print_queries(pretty=True)
# Example pretty printed output:
"""
QUERY #1
----------
SELECT 1
QUERY #2
----------
SELECT 1
"""
API
DBInspector.get_count() -> int
DBInspector.print_queries(pretty=False)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dbinspector-0.1.0.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for dbinspector-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 167ddf2efcf856b83ef0de1d407e86c029405bf93dd840626fe190cd17e644a5 |
|
MD5 | 408f1d236aecff04f940069b35b17ebd |
|
BLAKE2b-256 | 4483c54a0df3052336518413dadbee3113ddadc85dcf212f3b3cbf3268b9e677 |