File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ ## Alembic support in ` SQLAlchemyBindManager `
2+
3+ [ Alembic] ( https://alembic.sqlalchemy.org/en/latest/ )
4+ is a database migration tool widely used with SQLAlchemy.
5+
6+ While the installation and configuration of Alembic is not
7+ in the scope of this package, ` SQLAlchemyBindManager ` class
8+ provides the method ` get_bind_mappers_metadata() ` for an easier
9+ integration with Alembic when using multiple binds. It will
10+ return each bind metadata organised in a dictionary, using
11+ the bind names as keys.
12+
13+ Alembic provides templates for synchronous engines and for
14+ asynchronous engines, but there is no template supporting
15+ both at the same time.
16+
17+ You can find an example Alembic configuration that works
18+ with synchronous and asynchronous engines at the same time,
19+ using the ` SQLAlchemyBindManager ` helper method, based on
20+ the following directory structure:
21+
22+ ```
23+ ├── alembic
24+ │ ├── env.py
25+ │ ├── script.py.mako
26+ │ └── versions
27+ └── alembic.ini
28+ ```
29+
30+ ## alembic.ini
31+
32+ /// details | alembic.ini
33+ ```
34+ --8<-- "docs/manager/alembic/alembic.ini"
35+ ```
36+ ///
37+
38+ ## env.py
39+
40+ /// details | env.py
41+ ``` py
42+ -- 8 < -- " docs/manager/alembic/env.py"
43+ ```
44+ ///
45+
46+ ## script.py.mako
47+
48+ /// details | script.py.mako
49+ ``` py
50+ -- 8 < -- " docs/manager/alembic/script.py.mako"
51+ ```
52+ ///
Original file line number Diff line number Diff line change 1212 features :
1313 - navigation.expand
1414 - navigation.top
15+ - content.code.copy
1516
1617 palette :
1718
4243 - Configuration : manager/config.md
4344 - Models setup : manager/models.md
4445 - Session usage : manager/session.md
46+ - Alembic : manager/alembic.md
4547 - Repository :
4648 - Repository usage : repository/repository.md
4749 - Unit of work : repository/uow.md
@@ -50,3 +52,5 @@ markdown_extensions:
5052 - pymdownx.details
5153 - pymdownx.blocks.admonition
5254 - pymdownx.blocks.details
55+ - pymdownx.snippets
56+ - pymdownx.superfences
You can’t perform that action at this time.
0 commit comments