/var/opt/nydus/ops/mysql/ai/utils/__pycache__
NameSizeModeActions
atomic_cursor.cpython-312.pyc26420644editdlrm
dependencies.cpython-312.pyc22940644editdlrm
utils.cpython-312.pyc199220644editdlrm
__init__.cpython-312.pyc7330644editdlrm
Edit: /var/opt/nydus/ops/mysql/ai/utils/__pycache__/atomic_cursor.cpython-312.pyc (2642B)
N jXdZddlmZddlmZddlmZddlmZededeefdZ y ) zAtomic transaction context manager utilities for MySQL Connector/Python. Provides context manager atomic_transaction() that ensures commit on success and rollback on error without obscuring the original exception. )contextmanager)Iterator)MySQLConnectionAbstract)MySQLCursorAbstractconnreturnc#K|j}|j}d} |rd|_||j ||_ |j y#t$r$d} |j #t$rYwxYwwxYw#t$r|sYywxYw#||_ |j w#t$r|sYwwxYwxYww)a Context manager that wraps a MySQL database cursor and ensures transaction rollback in case of exception. NOTE: DDL statements such as CREATE TABLE cause implicit commits. These cannot be managed by a cursor object. Changes made at or before a DDL statement will be committed and not rolled back. Callers are responsible for any cleanup of this type. This class acts as a robust, PEP 343-compliant context manager for handling database cursor operations on a MySQL connection. It ensures that all operations executed within the context block are part of the same transaction, and automatically calls `connection.rollback()` if an exception occurs, helping to maintain database integrity. On normal completion (no exception), it simply closes the cursor after use. Exceptions are always propagated to the caller. Args: conn: A MySQLConnectionAbstract instance. FTN) autocommitcursorcommit Exceptionrollbackclose)rold_autocommitr exception_raiseds M/opt/nydus/tmp/pip-target-a90h98xg/lib/python/mysql/ai/utils/atomic_cursor.pyatomic_transactionr*s.__N [[]F #DO  )  LLN    MMO         #$  )  LLN #$ sC AC B C  B%A65B6 B?BBBB BC BC C$B54C5 CCCCC N) __doc__ contextlibrtypingrmysql.connector.abstractsrmysql.connector.cursorrrrrsB: &=63 !3 !"33r