crate / sqlalchemy-cratedb

SQLAlchemy dialect for CrateDB.
https://cratedb.com/docs/sqlalchemy-cratedb/
Apache License 2.0
3 stars 2 forks source link

SQLAlchemy: Expecting `IntegrityError`, but `ProgrammingError` is raised #96

Closed amotl closed 11 months ago

amotl commented 1 year ago

About

At https://github.com/crate-workbench/mlflow-cratedb/issues/9, we discovered that the CrateDB SQLAlchemy dialect raises a ProgrammingError exception when the server raises a DuplicateKeyException. However, SQLAlchemy-based applications seem to expect the IntegrityError exception type instead, see sqlalchemy_store.py.

Details

mlflow-cratedb has a monkeypatch, which augments the _raise_for_status function to emit an IntegrityError correspondingly.

Proposal

Add this to the code base, untangled from the monkeypatch, together with an accompanying test case, if not present.

amotl commented 11 months ago

This has been implemented with crate/crate-python#583, and we did not receive any complaints so far.