Skip to main content

QueryShield probe for FastAPI and SQLAlchemy ORM

Project description

queryshield-sqlalchemy

SQLAlchemy database query performance probe for QueryShield.

Detect and analyze N+1 queries, missing indexes, slow queries, and other performance issues in SQLAlchemy applications.

Features

  • N+1 query detection
  • EXPLAIN plan analysis
  • Missing index detection
  • Query budget enforcement
  • Integration with pytest
  • Integration with FastAPI
  • Multi-database support (PostgreSQL, MySQL, SQLite)

Installation

pip install queryshield-sqlalchemy

Usage

Pytest Integration

from queryshield_sqlalchemy import QueryShieldProbe

def test_user_queries(session):
    probe = QueryShieldProbe(session)
    
    users = session.query(User).all()
    for user in users:
        print(user.email)
    
    report = probe.finalize()

FastAPI Integration

from queryshield_sqlalchemy import FastAPIProbe

app = FastAPI()
probe = FastAPIProbe()

@app.get("/users")
def get_users(session: Session):
    users = session.query(User).all()
    return users

Documentation

See the main QueryShield documentation for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

queryshield_sqlalchemy-0.2.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file queryshield_sqlalchemy-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for queryshield_sqlalchemy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17b402d1e4ef339f65e3fc5a6c6b02b21e0a6c82bc6ca644d05cfc78de939133
MD5 98c2f8d5fe907609b9c04de8224b46d6
BLAKE2b-256 2b02e3d7b15e16aeb1ab72584a2c169084c2b3140896679eae0bc6f9423912df

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