Skip to main content

Flask-Alembic

Flask-Alembic is a Flask extension that provides a configurable Alembic migration environment around a Flask-SQLAlchemy database.

Installation

Install from PyPI:

$ pip install Flask-Alembic

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.config instead of alembic.ini and env.py.
  • The migrations are stored directly in the migrations folder instead of the versions folder.
  • Provides the migration environment instead of env.py and 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.
  • Does not (currently) support offline migrations. I don't plan to add this but am open to patches.
  • Does not (currently) support multiple databases. I plan on adding support for Flask-SQLAlchemy binds and external bases eventually, or am open to patches.
  • Adds a system for managing independent migration branches and makes it easier to work with named branches.

Metadata

Release files for Flask-Alembic 3.0.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 Flask-Alembic 3.0.0
File Size Uploaded Provenance Actions
flask_alembic-3.0.0.tar.gz 9.3 kB Without provenance Details for flask_alembic-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Alembic 3.0.0
File Interpreter ABI Platform Actions
flask_alembic-3.0.0-py3-none-any.whl Python 3 none any Details for flask_alembic-3.0.0-py3-none-any.whl

Total release size: 19.0 kB

Release files / flask_alembic-3.0.0.tar.gz

Download URL flask_alembic-3.0.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0c1e793d978e8adad9a5ae9dcc69ac06fe5ebb6384918922d5b4b0f165f3680f
BLAKE2b-256 checksum
How to use checksums
3c497b2e45b820e76ac87a95c688fe678d23b3e44e6fba07f1ad92c8af4665ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / flask_alembic-3.0.0-py3-none-any.whl

Download URL flask_alembic-3.0.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae62ce2791ad56a7a88220c60d6e7e8be28479d8aa271e358a0540934705ccc3
BLAKE2b-256 checksum
How to use checksums
d134b71387899032c3f104b662cac373913970f66b4d854aa1ebe84b63665f37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Security for Flask-Alembic 3.0.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.

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