diff --git a/src/api/database/database.py b/src/api/database/database.py index db4e8f4fb670e3759bafda4d849aee41a1c36add..18fbbecfa5426af5713019ac01d6985f5f41aba0 100644 --- a/src/api/database/database.py +++ b/src/api/database/database.py @@ -715,31 +715,6 @@ class DbConnectionPool: pass self._on_connection_released(True, connection) - @contextmanager - def start_read_transaction(self) -> ReadTransaction: - """ - Starts a read-only transaction. - - May raise :class:`NoAvailableConnectionError` - """ - transaction = None - try: - if self._factory.supports_per_transaction_writeable_flag(): - connection = self._cache.get_connection() - else: - connection = self._read_cache.get_connection() - transaction = ReadTransaction(lambda: self._on_connection_released(False, connection), connection) - yield transaction - if not transaction.is_closed(): - print("Warning: Rolling open transaction back after execution but there was no exception (Always " - "close the transaction explicitly)") - transaction.close() - except Exception: - if transaction is not None and not transaction.is_closed(): - _COUNTERS_TRANSACTION_ABORTED_BY_USER["read"].trigger() - transaction.on_error_close_transaction() - raise - def execute_read_statement_in_transaction(self, statement: PreparedStatement or str, *values: DbValueType) -> DbResultSet: