{"id":21350,"library":"flask-alembic","title":"flask-alembic","description":"Integrates Alembic database migrations with Flask applications. Current stable version 3.2.0, released 2025-10-15. Supports Flask-SQLAlchemy, Flask-SQLAlchemy-Lite, and plain SQLAlchemy. Python >=3.10 required.","status":"active","version":"3.2.0","language":"python","source_language":"en","source_url":"https://github.com/pallets-eco/flask-alembic/","tags":["flask","alembic","migrations","database","sqlalchemy"],"install":[{"cmd":"pip install flask-alembic","lang":"bash","label":"Latest stable"}],"dependencies":[{"reason":"Required: core Flask integration","package":"Flask","optional":false},{"reason":"Common but optional: if using Flask-SQLAlchemy extension","package":"Flask-SQLAlchemy","optional":true},{"reason":"Alternative to Flask-SQLAlchemy","package":"Flask-SQLAlchemy-Lite","optional":true}],"imports":[{"note":"Old wrapper name before 3.0, now removed","wrong":"from flask_alembic import FlaskAlembic","symbol":"Alembic","correct":"from flask_alembic import Alembic"}],"quickstart":{"code":"from flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_alembic import Alembic\n\napp = Flask(__name__)\napp.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'\ndb = SQLAlchemy(app)\nalembic = Alembic(app)\n\nwith app.app_context():\n    alembic.init()\n    alembic.revision('Initial migration')\n    alembic.upgrade()","lang":"python","description":"Initialize Alembic, create first migration, and apply it."},"warnings":[{"fix":"Update Python to 3.8+ and pip install flask-alembic>=3.0","message":"Flask-Alembic 3.0 dropped support for Python 2 and Python <3.8. Upgrade to Python 3.8+.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Change import to `from flask_alembic import Alembic` and instantiate `Alembic(app)`","message":"The `FlaskAlembic` class was removed in 3.0. Use `Alembic` instead.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Pass `metadatas` dict to `Alembic(app, metadatas={'db1': metadata1})`","message":"When using multiple databases, you must specify which metadata to associate with each database in the `Alembic` constructor.","severity":"gotcha","affected_versions":">=3.1.0"},{"fix":"Use `flask db` commands only after configuring the Flask app (e.g., via `FLASK_APP` env var).","message":"The Flask application context must be active for most `alembic` CLI commands (e.g., `flask db upgrade`).","severity":"gotcha","affected_versions":"all"},{"fix":"Remove `command_name` from Alembic() call.","message":"In 3.1.0, the `command_name` constructor argument was deprecated. Use the default command name or override via config.","severity":"deprecated","affected_versions":"3.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Replace `from flask_alembic import FlaskAlembic` with `from flask_alembic import Alembic`.","cause":"FlaskAlembic was removed in 3.0; use Alembic instead.","error":"ImportError: cannot import name 'FlaskAlembic' from 'flask_alembic'"},{"fix":"Ensure your custom env.py imports your SQLAlchemy models and sets `target_metadata` correctly.","cause":"Alembic checks are overly strict for non-SQLite databases when using custom env.py.","error":"flask db init fails with 'This environment only supports SQLite'"},{"fix":"Wrap code in `with app.app_context():` or use `flask shell` to run commands interactively.","cause":"Alembic or Flask commands executed without Flask app context.","error":"RuntimeError: Working outside of application context."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}