crate / crate-python

Python DB API client library for CrateDB, using HTTP.
https://cratedb.com/docs/python/
Apache License 2.0
78 stars 31 forks source link

Improve exception handling: Properly raise `IntegrityError` exceptions #583

Closed amotl closed 1 year ago

amotl commented 1 year ago

About

When receiving DuplicateKeyException errors from CrateDB, SQLAlchemy should raise corresponding IntegrityError exceptions instead of ProgrammingError, because applications expect it this way.

Details

This patch evaluates the area preliminarily, mainly whether it will work by using CrateDB's own variants of the canonical DBAPI exceptions, and whether SQLAlchemy will honor that properly.

References

matriv commented 1 year ago

Apologies, accidentally I approved already, instead of only comment.

amotl commented 1 year ago

Thanks. I've just amended the patch to provide a corresponding test case.