I am using sqlalchemy-0.3.10 in conjunction with firebird.
When trying to flush (inside a try loop) an object with a value which
violates a unique constraint, i am getting a server error which
amounts to:
"<class 'sqlalchemy.exceptions.SQLError'>: (ProgrammingError) (-803,
'isc_dsql_execute: \n violation of PRIMARY or UNIQUE KEY constraint
"INTEG_234" on table "USERS"')....
I expect this error, that is why the dbsession.save(upd_usr) and
dbsession.flush() are inside of a try/except loop.
try:
self.dbsession.save(c.cur_user)
self.dbsession.flush()
except :
c.errors.append("failed adding/editing.....
Now for the question: exception is being raised, but try/except loop
is not catching it... Am I crazy to think that I should be able to
detect constraint violations at time of insert/update by wrapping in
try/except??? What is the right way to verify that inserts/updates
meet DB constraints?
Thanks for the help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---