Flask-Alembic
Flask-Alembic is a Flask extension that provides a configurable Alembic database migration environment. Supports Flask-SQLAlchemy, Flask-SQLAlchemy-Lite, or plain SQLAlchemy. Supports Alembic's single and multiple database templates.
Pallets Community Ecosystem
Basic Usage
You've created a Flask application and some models with Flask-SQLAlchemy. Now start using Flask-Alembic:
from flask_alembic import Alembic
# Intialize the extension
alembic = Alembic()
alembic.init_app(app)
Commands are added to the flask CLI:
$ flask db --help
$ flask db revision "making changes"
$ flask db upgrade
You can also access Alembic's functionality from Python:
with app.app_context():
# Auto-generate a migration
alembic.revision('making changes')
# Upgrade the database
alembic.upgrade()
# Access the internals
environment_context = alembic.env
Differences from Alembic
- Configuration is taken from
Flask.configinstead ofalembic.iniandenv.py. - Engines and model/table metadata are taken from Flask-SQLAlchemy(-Lite) if available, or can be configured manually.
- The migrations are stored directly in the
migrationsfolder instead of theversionsfolder. - Provides the migration environment instead of
env.pyand exposes Alembic's internal API objects. - Differentiates between CLI commands and Python functions. The functions return revision objects and don't print to stdout.
- Allows operating Alembic at any API level while the app is running, through the exposed objects and functions.
- Adds a system for managing independent migration branches and makes it easier to work with named branches.
- Does not (currently) support offline migrations. I don't plan to work on this but am open to patches.
- Does not (currently) support async engines. I don't plan to work on this but am open to patches.
Metadata
Release files for Flask-Alembic 3.1.0
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 |
|---|---|---|---|---|
| flask_alembic-3.1.0.tar.gz | 11.9 kB | Without provenance | Details for flask_alembic-3.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_alembic-3.1.0-py3-none-any.whl | Python 3 | none | any | Details for flask_alembic-3.1.0-py3-none-any.whl |
Total release size: 24.0 kB
Release files / flask_alembic-3.1.0.tar.gz
| Download URL | flask_alembic-3.1.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acf4a5a5e8345f599e68c87ef7c8af99509f14751e2db942e5da005c4b63435b
|
|
BLAKE2b-256 checksum How to use checksums |
072e2aaff58b94c379fa2fd2c8d4e6c24f11f0c1672974a8b1badd512ff81ec8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.4
|
Release files / flask_alembic-3.1.0-py3-none-any.whl
| Download URL | flask_alembic-3.1.0-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf094295f49c7cadd3112f4e67dbee92cbd9765b8f1c5fd8b5fda2807ea16a70
|
|
BLAKE2b-256 checksum How to use checksums |
86b462a9d839ca9cce357f9fd06d7fddd627872c709cc35eb8425a53015cc846
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.4
|
Security for Flask-Alembic 3.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.