mkdocs-sqlalchemy-plugin
MkDocs plugin to generate docs from SQLAlchemy models.
Features
- Automatic Documentation: Generates tables documenting your SQLAlchemy models.
- Customizable: Configure which fields to show, table styling, and more.
- Filtering: Include or exclude specific tables.
- SQL DDL: Optionally display the SQL
CREATE TABLEstatements. - Schema Support: Group tables by schema.
Installation
Install the plugin using pip:
pip install mkdocs-sqlalchemy-plugin
Quick Start
-
Configure
mkdocs.yml:Add the plugin to your
mkdocs.ymlconfiguration file. You must specify thebase_classwhich is the import path to your SQLAlchemyDeclarativeBase.plugins: - sqlalchemy: base_class: "my_app.models.Base" app_path: "src" -
Add to Markdown:
In your markdown files, use the
sqlalchemytag where you want the documentation to appear.{% sqlalchemy %} -
Build Docs:
Run
mkdocs serveto see your documentation.
Configuration
The plugin offers extensive configuration options to tailor the output to your needs. See the Configuration Options page for a full reference.
Usage
The {% sqlalchemy %} tag is powerful and supports local overrides. See the Tag Usage page for details.