(connection_name: str | None)
| 16 | |
| 17 | |
| 18 | def _get_connection(connection_name: str | None) -> BaseDBAsyncClient: |
| 19 | conn_handler = get_connections() |
| 20 | if connection_name: |
| 21 | connection = conn_handler.get(connection_name) |
| 22 | elif len(conn_handler.db_config) == 1: |
| 23 | connection_name = next(iter(conn_handler.db_config.keys())) |
| 24 | connection = conn_handler.get(connection_name) |
| 25 | else: |
| 26 | raise ParamsError( |
| 27 | "You are running with multiple databases, so you should specify" |
| 28 | f" connection_name: {list(conn_handler.db_config)}" |
| 29 | ) |
| 30 | return connection |
| 31 | |
| 32 | |
| 33 | def in_transaction(connection_name: str | None = None) -> TransactionContext: |
no test coverage detected
searching dependent graphs…