Flask extension to integrate Alembic migrations
Project description
This Flask extension provides a configurable Alembic migration environment around a Flask-SQLAlchemy database.
Installation
Install releases from PyPI:
pip install Flask-Alembic
Install latest code from BitBucket:
pip install https://bitbucket.org/davidism/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) # Auto-generate a migration alembic.revision('making changes') # Upgrade the database alembic.upgrade() # Access the internals environment_context = alembic.env
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file Flask-Alembic-1.0.0.tar.gz
.
File metadata
- Download URL: Flask-Alembic-1.0.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5696fe2c6702ffce892bef91730aa77eb8161c59eb9e92acda32c10fdfe15936 |
|
MD5 | 03c37f9e308e4627d9e37e3a1beb8724 |
|
BLAKE2b-256 | 91ad41092ef1e822da015cbdcf57ee9f4cd8717e6aae420de70ffc65edbd39d8 |