Skip to main content

fastapi-healthcheck-sqlalchemy

A module built on top of fastapi_healthcheck to check the status of your SQLAlchemy connection. This requires a Table given to the health check so it can run a count of rows against it. As long as it returns a value, the connection is alive.

Install

pip install fastapi-healthcheck-sqlalchemy or poetry add fastapi-healthcheck-sqlalchemy

How to use

This module just exposes the service layer that will be used to parse your middleware connection to your database.

from fastapi import FastAPI
from fastapi_sqlalchemy import DBSessionMiddleware
from fastapi_healthcheck import HealthCheckFactory, healthCheckRoute
from fastapi_healthcheck_sqlalchemy import HealthCheckSQLAlchemy


app = FastAPI()

# Bring SQLAlchemy online first.
app.add_middleware(DBSessionMiddleware, db_url=cs.value)

_healthChecks = HealthCheckFactory()
_healthChecks.add(
    HealthCheckSQLAlchemy(
        # The name of the object for your reference
        alias='postgres db',  

        # The Table that we will run a count method against.
        table=SmtpContactsSqlModel, 

        tags=('postgres', 'db', 'sql01')
    )
)

app.add_api_route('/health', endpoint=healthCheckRoute(factory=_healthChecks))

Metadata

Release files for fastapi-healthcheck-sqlalchemy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastapi-healthcheck-sqlalchemy 0.1.0
File Size Uploaded
fastapi-healthcheck-sqlalchemy-0.1.0.tar.gz 2.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-healthcheck-sqlalchemy 0.1.0
File Interpreter ABI Platform
fastapi_healthcheck_sqlalchemy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.8 kB

Release files / fastapi-healthcheck-sqlalchemy-0.1.0.tar.gz

Download URL fastapi-healthcheck-sqlalchemy-0.1.0.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ab0e47955fb37f5204aa642d4e5a884f1b58111f63c89f5936662091e910da7c
BLAKE2b-256 checksum
How to use checksums
714be6537559f9def1dfe3b9c27622f1fbec4c112cbb40850e48542cd6b76a26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.9 Darwin/20.6.0

Release files / fastapi_healthcheck_sqlalchemy-0.1.0-py3-none-any.whl

Download URL fastapi_healthcheck_sqlalchemy-0.1.0-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1edff5e07f8a6e0c23975fce23d3e995ba30b4fa52c643b94bd1831992c5ddd7
BLAKE2b-256 checksum
How to use checksums
2e252d8f60bb10c12d236d914e28d9a3543d5a0ee55c65193aab8b6a16277272
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.9 Darwin/20.6.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page