Flask-AppBuilder (FAB) is a simple and rapid application development framework built on top of Flask. It provides detailed security features, automatic CRUD generation for database models, Google Charts integration, and more. It is currently at version 5.2.0 and maintains an active release cadence with frequent updates and new features. [3, 4]
pip install Flask-AppBuilderVerified import paths — ran on the pinned version, not inferred.
This quickstart sets up a minimal Flask-AppBuilder application with a simple SQLAlchemy model and a corresponding ModelView for CRUD operations. It initializes Flask, Flask-SQLAlchemy, and Flask-AppBuilder, then registers a basic view. You'll need to set a `FLASK_SECRET_KEY` environment variable or replace the placeholder. After running, use `flask fab create-admin` to set up an administrative user. [2, 8, 10, 12, 21]
Migrate MongoDB data to a supported SQL database (PostgreSQL, MySQL, SQLite, etc.). Update models to use SQLAlchemy syntax. Switch from OpenID 2.0 to OAuth 2.0, LDAP, SAML, or database authentication. Remove `flask-mongoengine`, `mongoengine`, `pymongo`, `flask-openid` dependencies. [1]
Review and update SQLAlchemy query patterns to align with 2.x best practices. Ensure Flask-SQLAlchemy is configured correctly. For `AppBuilder` initialization, pass `db.session` directly rather than the `db` object itself. If encountering `SQLA` import errors, consider `from flask_appbuilder.utils.legacy import get_sqla_class()` or use Flask-SQLAlchemy's `db` object directly for models and session. [1, 13]
Review migration guides for each updated dependency (Flask, Jinja2, Werkzeug, etc.) and adapt application code accordingly. Ensure all dependencies are updated and compatible with Flask-AppBuilder v4.0.0+. [14]
Always back up your database before migrations. For the very first migration, if you encounter `No changes in schema detected`, you might need to drop all `ab_` tables and the `alembic_version` table, then run `flask db upgrade` to create all tables and initialize Alembic correctly. Use `flask fab upgrade-db` after a Flask-AppBuilder upgrade. [2, 23]
Always set `app.config['SECRET_KEY']` to a long, random, and secret string. It's best practice to load this from an environment variable (e.g., `os.environ.get('FLASK_SECRET_KEY')`) rather than hardcoding it. [12, 21]Update `OAUTH_PROVIDERS` configuration in `config.py` to use the new `client_id` and `client_secret` keys within the `remote_app` dictionary. Also ensure `authlib` is correctly installed and used. [14]
Ensure you are using the latest `flask fab create-app` command to generate your project, and update imports to reflect the current structure, which may not include a dedicated 'extensions' module. Downgrading Flask-AppBuilder to a compatible version (e.g., 4.8.1) can also resolve issues with older project setups.
Update your import statement from `from flask_appbuilder import SQLA` to `from flask_appbuilder.models.sqla.base import SQLA`.
Ensure that `appbuilder.init_app(app, db.session)` is correctly called within your application's initialization logic, and that the `FLASK_APP` environment variable points to your application's entry point where `AppBuilder` is instantiated.
If `flask fab create-app` generated `config.py.tpl`, rename it to `config.py` in your application's root directory. Verify that your `FLASK_APP` environment variable is set correctly to allow Flask to find your application and its configuration.