Skip to main content

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


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.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbinspector-0.1.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file dbinspector-0.1.1.tar.gz.

File metadata

  • Download URL: dbinspector-0.1.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for dbinspector-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6d419f927efbbbf567c42da547e0df969b589177588518e77106d657eefe735b
MD5 60ea2c15bbe8bfc72ce5cde0af5f73e1
BLAKE2b-256 f39ede17e88de54337538ce28feef0f45176c64da8835fefa5628ddd203c45f3

See more details on using hashes here.

File details

Details for the file dbinspector-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dbinspector-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for dbinspector-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0beb6b71a463f680c33a7ed29c791e1428a131f71c740ef68c23fc152d60c5f
MD5 e9f514832fdacf15bae8969877f137e1
BLAKE2b-256 da51be1df3015d2750d53cd9e26d11eea9f9ef412fbbafb6ea8cd8e6b853cd49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page