SQLAlchemy Helpers
This project contains a tools to use SQLAlchemy and Alembic in a project.
It has Flask and FastAPI integrations, and other framework integrations could be added in the future.
The full documentation is on ReadTheDocs.
You can install it from PyPI.
Features
Here's what sqlalchemy-helpers provides:
- Alembic integration:
- programmatically create or upgrade your schema,
- get information about schema versions and status
- drop your tables without leaving alembic information behind
- use a function in your
env.pyscript to retrieve the database URL, and thus avoid repeating your configuration in two places. - migration helper functions such as
is_sqlite()orexists_in_db()
- SQLAlchemy naming convention for easier schema upgrades
- Automatically activate foreign keys on SQLite
- Addition of some useful query properties on your models
- Functions such as
get_or_create()orupdate_or_create()that you can call directly or use on your model classes - Optional Flask integration: you can use sqlalchemy-helpers outside of a Flask app and feel at home
- The models created with sqlalchemy-helpers work both inside and outside the Flask application context
- Support for asyncio and FastAPI.
This project has 100% code coverage and aims at reliably sharing some of the basic boilerplate between applications that use SQLAlchemy.
Check out the User Guide to learn how to use it in your application, with or without a web framework.
FAQ
- Why not use Flask-SQLAlchemy and Flask-Migrate?
Those projects are great, but we also have apps that are not based on Flask and that would benefit from the features provided by sqlalchemy-helpers.
- Is it used?
Quite a few applications among the Fedora Infrastructure applications use this library to avoid code duplication. It is unlikely that we'll drop it, unless we drop SQLAlchemy itself, or Python. Which is even more unlikely.
Metadata
Release files for sqlalchemy-helpers 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlalchemy_helpers-2.0.1.tar.gz | 42.1 kB | With provenance | Details for sqlalchemy_helpers-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlalchemy_helpers-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for sqlalchemy_helpers-2.0.1-py3-none-any.whl |
Total release size: 69.3 kB
Release files / sqlalchemy_helpers-2.0.1.tar.gz
| Download URL | sqlalchemy_helpers-2.0.1.tar.gz |
|---|---|
| Size | 42.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6b1799fcc13edfeae90e2c09b1f15729ff02497c6ae10848f4b3f4c3cf72aa2
|
|
BLAKE2b-256 checksum How to use checksums |
891c86fd570a2a0a21a21a8bf9b7954d9285a022fba201eed346a7c9b99a255d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2025.
Transparency logRelease files / sqlalchemy_helpers-2.0.1-py3-none-any.whl
| Download URL | sqlalchemy_helpers-2.0.1-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c37737674245ead7d679e08ff63e908f8d9ce2d6dd79c0619cfd37224e336113
|
|
BLAKE2b-256 checksum How to use checksums |
e94da837b659421d3783322f7ca11bd748b20fa953cf8a5be84df87a6fcad977
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2025.
Transparency logSecurity for sqlalchemy-helpers 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for sqlalchemy_helpers-2.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.