Registry / web-framework / flask-appbuilder

flask-appbuilder

JSON →
library5.2.2pypypi✓ verified 27d ago

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-AppBuilder
INSTALL
IMPORT
SIG · FLASK-APPBUILDER
F
flask-appbuilder
web-frameworkpythonv5.2.2
Install
8.8s avg
Import
2705ms
Disk
112MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 2.740s · 109.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 8.8s · import 2.670s · 108MB
112MB installed
● package 112MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AppBuilder
from flask_appbuilder import AppBuilder
SQLA
from flask_appbuilder import SQLA
from flask_appbuilder.models.sqla.base import SQLA
While older versions or specific examples might show a submodule import, the recommended minimal quickstart for current versions directly imports `SQLA` from `flask_appbuilder` for its SQLAlchemy database object. [2, 13]
ModelView
from flask_appbuilder import ModelView
SQLAInterface
from flask_appbuilder.models.sqla.interface import SQLAInterface

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]

import os from flask import Flask from flask_appbuilder import SQLA, AppBuilder, ModelView from flask_appbuilder.models.sqla.interface import SQLAInterface # Your App class class MyUser(SQLA.Model): id = SQLA.Column(SQLA.Integer, primary_key=True) name = SQLA.Column(SQLA.String(50), unique=True, nullable=False) def __repr__(self): return self.name # Instantiate Flask app app = Flask(__name__) app.config['SECRET_KEY'] = os.environ.get('FLASK_SECRET_KEY', 'a-very-secret-key-that-you-should-change') app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(os.path.dirname(__file__), 'app.db') app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # Instantiate SQLAlchemy and AppBuilder db = SQLA(app) appbuilder = AppBuilder(app, db.session) # Create a ModelView for MyUser class MyUserView(ModelView): datamodel = SQLAInterface(MyUser) list_columns = ['name'] # Add the view to AppBuilder appbuilder.add_view(MyUserView, 'List My Users', icon='fa-users', category='My App') # To run the app: # $ export FLASK_APP=your_app_file_name.py # $ flask fab create-admin (follow prompts to create an admin user) # $ flask run # Access at http://127.0.0.1:5000
flask fab --version
Debug
Known issues
breakingFlask-AppBuilder 5.0.0 completely removed support for MongoDB/MongoEngine and OpenID 2.0 authentication. Applications relying on these backends will require significant migration to SQLAlchemy-based databases and alternative authentication methods (e.g., OAuth2, LDAP, SAML). [1, 11, 16, 17]
fix
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]
affects: >=5.0.0
breakingVersion 5.0.0 introduced breaking changes for SQLAlchemy 2.x and Flask-SQLAlchemy 3.x compatibility. This affects query syntax, session handling, relationship loading, and potentially the `SQLA` import path or how the SQLAlchemy object is passed to `AppBuilder`. [1, 11, 13, 24, 25]
fix
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]
affects: >=5.0.0
breakingFlask-AppBuilder 4.0.0 introduced major version bumps for several core Flask dependencies including Flask (1.x to 2.x), Flask-JWT-Extended (3.x to 4.x), Jinja2 (2.x to 3.x), Werkzeug (1.x to 2.x), pyJWT (1.x to 2.x), and Click (7.x to 8.x). These changes often come with their own breaking changes. [14]
fix
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]
affects: >=4.0.0
gotchaDatabase migrations with Alembic (managed by Flask-Migrate via `flask fab`) require careful handling, especially on initial setup or when schema changes are introduced. Simply running `flask db migrate` might not detect changes if the setup isn't exact. [23]
fix
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]
affects: All versions
gotchaThe `SECRET_KEY` configuration is crucial for Flask's session security. Using a weak or default key in production makes the application vulnerable to session hijacking and other attacks. [12, 21]
fix
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]
affects: All versions
gotchaThe configuration structure for OAuth providers changed significantly in version 4.0.0, specifically impacting the keys used for client credentials (e.g., `consumer_key` and `consumer_secret` were replaced by `client_id` and `client_secret`). [14]
fix
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]
affects: >=4.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'flask_appbuilder.extensions'
This error often occurs in Flask-AppBuilder 5.0.0+ when the project structure or imports do not align with the updated framework, or if an older skeleton app is being used with a newer version.
fix
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.
ImportError: cannot import name 'SQLA' from 'flask_appbuilder'
This is a breaking change introduced in Flask-AppBuilder 5.0.0; the `SQLA` class was moved to a more specific submodule.
fix
Update your import statement from `from flask_appbuilder import SQLA` to `from flask_appbuilder.models.sqla.base import SQLA`.
AttributeError: 'Flask' object has no attribute 'appbuilder'
This error indicates that the `AppBuilder` instance was not properly initialized and associated with your Flask application before being accessed, commonly when running `flask fab` CLI commands.
fix
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.
ModuleNotFoundError: No module named 'config'
This usually happens when the configuration file (`config.py`) is missing, incorrectly named, or not discoverable in the expected path, especially after generating a new project.
fix
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.
Upgrade
Version history
5.2.2latest on PyPI · released Jun 23, 2026
Audit
Dependencies
FlaskrequiredCore web framework upon which Flask-AppBuilder is built.
Flask-SQLAlchemyrequiredProvides SQLAlchemy integration for database management, a core feature for model views.
SQLAlchemyrequiredORM used for database interaction; Flask-AppBuilder heavily leverages its declarative syntax.
Flask-LoginrequiredManages user sessions and authentication.
Flask-BabelrequiredProvides internationalization and localization support.
Flask-WTFrequiredIntegrates WTForms for web forms, used extensively in CRUD operations.
AuthliboptionalRequired for OAuth 2.0 authentication support.
python3-samloptionalRequired for SAML 2.0 authentication support.
Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
1
Resources
flask-appbuilder — pip install flask-appbuilder · libregistry