Get a database connection by alias from the current context. This is a convenience function. Prefer accessing connections directly via context: `ctx.connections.get(alias)` :param alias: The connection alias (e.g., "default") :raises ConfigurationError: If no context is active
(alias: str)
| 313 | |
| 314 | |
| 315 | def get_connection(alias: str) -> BaseDBAsyncClient: |
| 316 | """ |
| 317 | Get a database connection by alias from the current context. |
| 318 | |
| 319 | This is a convenience function. Prefer accessing connections directly |
| 320 | via context: `ctx.connections.get(alias)` |
| 321 | |
| 322 | :param alias: The connection alias (e.g., "default") |
| 323 | :raises ConfigurationError: If no context is active or connection not found |
| 324 | """ |
| 325 | from tortoise.context import require_context |
| 326 | |
| 327 | return require_context().connections.get(alias) |
| 328 | |
| 329 | |
| 330 | def get_connections() -> ConnectionHandler: |
no test coverage detected
searching dependent graphs…