sqlalchemy-hana icon indicating copy to clipboard operation
sqlalchemy-hana copied to clipboard

Raise dedicated exception for LOCK_ACQUISITION_FAIL

Open jarus opened this issue 6 years ago • 0 comments

If an application uses SQLAlchemy-HANA for serialized transaction updates with SELECT ... FOR UPDATE then you probably find something like the following in various places:

try:
    # SELECT ... WITH FOR UPDATE NOWAIT
except DBAPIError as exc:
    if exc.orig.errorcode == 146:
        # Special handling

A better and more reusable approach could be the introduction of a dedicated SQLAlchemy-HANA exception like RowLockAcquisitionError.

jarus avatar Mar 06 '19 15:03 jarus