[Sqlalchemy-tickets] [sqlalchemy] #2915: Different database backend raise different exceptions on n
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2014-01-21 11:04:07
|
#2915: Different database backend raise different exceptions on not null
constraint violations
--------------------+-----------------------------------------
Reporter: guidow | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: engine | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
--------------------+-----------------------------------------
I noticed that different database backends may cause different exceptions
to be raised when violating a not null constraint.
Sqlite, for example, seems to raise IntegrityError, while MySQL with
mysql-python raises OperationalError and postgresql with pg8000 raises
ProgrammingError.
This is a bit of a problem when developing software that is supposed to be
backend-agnostic. You can still catch the exception by catching the parent
class DatabaseError, but this is not helpful when you are trying to figure
out what exactly went wrong.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2915>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|