sqlalchemy-hana
sqlalchemy-hana copied to clipboard
Raise dedicated exception for LOCK_ACQUISITION_FAIL
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.