Skip to main content

Flask-Alembic

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

Full documentation

Installation

Install releases from PyPI:

pip install Flask-Alembic

Install the latest code from BitBucket:

pip install https://bitbucket.org/davidism/flask-alembic/get/default.tar.gz

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)

# Auto-generate a migration
alembic.revision('making changes')

# Upgrade the database
alembic.upgrade()

# Access the internals
environment_context = alembic.env

Commands are included for Click and Flask-Script:

$ ./manage.py db revision "making changes"
$ ./manage.py db upgrade

Differences from Alembic core

  • Configuration is taken from Flask instead of alembic.ini.

  • The migrations are stored directly in the migrations folder instead of the versions folder.

  • The extension provides the migration environment instead of env.py.

  • Does not (currently) support offline migrations.

Differences from Flask-Migrate

Flask-Migrate is a simple wrapper around the existing Alembic commands. It associates the Flask-SQLAlchemy database with Alembic, and wraps the Alembic commands with Flask-Script. It still requires the standard Alembic file structure, does not integrate with Flask configuration, and does not expose the Alembic internals.

TODO

  • See if db.session can be used rather than establishing new connections.

  • Support multiple databases though Flask-SQLAlchemy’s binds.

  • Support offline migrations.

Metadata

Release files for Flask-Alembic 1.2.1

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 1.2.1
File Size Uploaded Provenance Actions
Flask-Alembic-1.2.1.tar.gz 14.7 kB Without provenance Details for Flask-Alembic-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Alembic 1.2.1
File Interpreter ABI Platform Actions
Flask_Alembic-1.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for Flask_Alembic-1.2.1-py2.py3-none-any.whl

Total release size: 24.0 kB

Release files / Flask-Alembic-1.2.1.tar.gz

Download URL Flask-Alembic-1.2.1.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
28f2df9fa7220c3e07b4fa314a244bca6e084ca3aadafdda1f171a619115f503
BLAKE2b-256 checksum
How to use checksums
4e7e32a50e6c4378c06184c522be7ba503391a8963b40c237e37e561883c1c3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Flask_Alembic-1.2.1-py2.py3-none-any.whl

Download URL Flask_Alembic-1.2.1-py2.py3-none-any.whl
Size 9.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
fea5cfdacea519ed45dfb0e239016f019bf95aea99463e330440e9d41b245f46
BLAKE2b-256 checksum
How to use checksums
b050f883e1a1230d1e4143349bae40da6144b02e5eef637ea6a5c12f1132208c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

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