#256 SQLObject doesn't handle psycopg2.IntegrityError

closed-fixed
Oleg Broytman
Postgres (36)
5
2014-12-14
2009-09-30
Anonymous
No

SQLObject throws psycopg2.IntegrityError (duplicate key value violates unique constraint "account_username_key") when in fact it should throw sqlobject.dberrors.IntegrityError.

try:
    person = Account\(username="rafael", password="senha", connection=conn\)

    person.addContact\(Contact\(email="rodrigo@mail.com", connection=conn\)\)
    person.addContact\(Contact\(email="maria@mail.com", connection=conn\)\)
except sqlobject.dberrors.IntegrityError, e:
    pass

Discussion

  • Oleg Broytman
    Oleg Broytman
    2009-10-12

    Only SQLiteConnection and MySQLConnection currently map DB API exceptions to sqlobject.dberrors.

     
  • Oleg Broytman
    Oleg Broytman
    2011-12-14

    Implemented in commit 4492.

     
  • Oleg Broytman
    Oleg Broytman
    2011-12-14

    • assigned_to: nobody --> phd
    • status: open --> closed-fixed