Skip to content

[database/exception] include the query information in database error for better debuging

Yet another commit, I guess it's an alternative to !137 (closed)

This will change an exception from something like :

psycopg2.IntegrityError: null value in column "asource" violates not-null constraint
DETAIL:  Failing row contains (341471, CWRType, null, null).

To:

psycopg2.IntegrityError: when doing the query 'INSERT INTO entities ( eid, type ) VALUES ( %(eid)s, %(type)s )' with the args '{'type': u'CWRType', 'eid': 341471}' got the error 'null value in column "asource" violates not-null constraint
DETAIL:  Failing row contains (341471, CWRType, null, null).'

Tested with sqlite3 and postgresql.

Edited by Nicolas Chauvat

Merge request reports