Skip to content

docs: add complete alembic integration example#1741

Open
pctablet505 wants to merge 2 commits into
ormar-orm:masterfrom
pctablet505:fix-1400-alembic-docs-example
Open

docs: add complete alembic integration example#1741
pctablet505 wants to merge 2 commits into
ormar-orm:masterfrom
pctablet505:fix-1400-alembic-docs-example

Conversation

@pctablet505

@pctablet505 pctablet505 commented Jul 15, 2026

Copy link
Copy Markdown

Fixes #1400.

The current Alembic docs skip too many steps for anyone new to ormar — imports, where metadata comes from, and how to handle models split across apps. I added a complete, working example based on the FastAPI-template reference linked in the issue.

It covers a single-file layout, a multi-app layout, a minimal alembic.ini, and wiring the shared metadata into alembic/env.py. I ran alembic revision --autogenerate and alembic upgrade head against both layouts and built the docs with mkdocs build to make sure everything works.

Expand the migrations/Alembic docs with a working, end-to-end example:

- Explain where the SQLAlchemy MetaData comes from in ormar and how to
  expose it for Alembic.
- Add a sample project layout with my_project/models.py, alembic.ini,
  and alembic/env.py.
- Show how to handle models split across multiple apps/packages by
  importing all models before Alembic reads the metadata.
- Keep the existing compare_type and include_object tips intact.

Fixes ormar-orm#1400
@codspeed-hq

codspeed-hq Bot commented Jul 16, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 98 untouched benchmarks


Comparing pctablet505:fix-1400-alembic-docs-example (db9168d) with master (e910772)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (710cdbb) during the generation of this report, so e910772 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@pctablet505
pctablet505 marked this pull request as ready for review July 17, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A *working* alembic example in the docs

1 participant