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 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 (Flask 0.11, or Flask-CLI):
$ flask db revision "making changes" $ flask db upgrade
and Flask-Script:
$ python manage.py db --help
Differences from Alembic core
Configuration is taken from Flask.config 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 or multiple databases.
Adds a system for managing independent migration branches and makes it easier to work with named branches.
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.
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
Built Distribution
File details
Details for the file Flask-Alembic-2.0.0.tar.gz
.
File metadata
- Download URL: Flask-Alembic-2.0.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ccbca096bbb64ae2c76547164f6fd174f46d3b861c9a081d06593b2476010fe |
|
MD5 | 00814db38c023d8af97d2584accd1d6d |
|
BLAKE2b-256 | 652b02722e01ea6739cf31c5ff01c41a9353050aba1becaaef4e712ffae8acd3 |
File details
Details for the file Flask_Alembic-2.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_Alembic-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d377ad8ba144f34c369f54706b67c9f927527cf39bf918c16ca0a99ce045dfe |
|
MD5 | b5a312d694cc230d125df38c4fc349fd |
|
BLAKE2b-256 | b1deebe0b3d6f89d923253c89c056f39ccf90c36914343959ce6dd44112103e9 |