Bind manager
sqlalchemy_bind_manager
sqlalchemy_bind_manager.SQLAlchemyBindManager
Source code in sqlalchemy_bind_manager/_bind_manager.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
get_bind_mappers_metadata
get_bind_mappers_metadata() -> Mapping[str, MetaData]
Returns the registered mappers metadata in a format that can be used in Alembic configuration
Returns:
Type | Description |
---|---|
Mapping[str, MetaData]
|
mappers metadata |
Source code in sqlalchemy_bind_manager/_bind_manager.py
154 155 156 157 158 159 160 161 |
|
get_bind
get_bind(bind_name: str = DEFAULT_BIND_NAME) -> Union[SQLAlchemyBind, SQLAlchemyAsyncBind]
Returns a bind object by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bind_name |
str
|
A registered bind name |
DEFAULT_BIND_NAME
|
Returns:
Type | Description |
---|---|
Union[SQLAlchemyBind, SQLAlchemyAsyncBind]
|
a bind object |
Source code in sqlalchemy_bind_manager/_bind_manager.py
163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
get_binds
get_binds() -> Mapping[str, Union[SQLAlchemyBind, SQLAlchemyAsyncBind]]
Returns all the registered bind objects.
Returns:
Type | Description |
---|---|
Mapping[str, Union[SQLAlchemyBind, SQLAlchemyAsyncBind]]
|
A mapping containing the registered binds |
Source code in sqlalchemy_bind_manager/_bind_manager.py
177 178 179 180 181 182 183 |
|
get_mapper
get_mapper(bind_name: str = DEFAULT_BIND_NAME) -> registry
Returns the registered SQLAlchemy registry_mapper for the given bind name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bind_name |
str
|
A registered bind name |
DEFAULT_BIND_NAME
|
Returns:
Type | Description |
---|---|
registry
|
the registered registry_mapper |
Source code in sqlalchemy_bind_manager/_bind_manager.py
185 186 187 188 189 190 191 192 |
|
get_session
get_session(bind_name: str = DEFAULT_BIND_NAME) -> Union[Session, AsyncSession]
Returns a SQLAlchemy Session object, ready to be used either directly or as a context manager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bind_name |
str
|
A registered bind name |
DEFAULT_BIND_NAME
|
Returns:
Type | Description |
---|---|
Union[Session, AsyncSession]
|
The SQLAlchemy Session object |
Source code in sqlalchemy_bind_manager/_bind_manager.py
194 195 196 197 198 199 200 201 202 203 204 |
|
sqlalchemy_bind_manager.SQLAlchemyConfig
Configuration for engines
Source code in sqlalchemy_bind_manager/_bind_manager.py
41 42 43 44 45 46 47 48 49 |
|