When sqlalchemy flushes pending changes to the database, sometimes those changes fail and raise a DatabaseError (eg, trying to delete a row that is referenced by a foreign key when the ON DELETE action is NO ACTION or RESTRICT). When that happens sqlalchemy enters a rollback state and requires the application is do an explicit session.rollback() before any other database actions can be done, yes?
My question is how is this normally managed in typical application code? A flush can potentially occur anytime a mapped attribute is changed. Do I need to wrap every such place in my code in a try/except to catch a possible error and do the rollback? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
