From a829b5c51b9246ffcf6703cd29efd7e155cd8ef3 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 23 Jan 2008 15:18:28 +0000 Subject: [PATCH] more descriptive error message for m2m concurrency error --- lib/sqlalchemy/orm/dependency.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py index f675aff500..fe6762056a 100644 --- a/lib/sqlalchemy/orm/dependency.py +++ b/lib/sqlalchemy/orm/dependency.py @@ -435,13 +435,13 @@ class ManyToManyDP(DependencyProcessor): statement = self.secondary.delete(sql.and_(*[c == sql.bindparam(c.key, type_=c.type) for c in self.secondary.c if c.key in associationrow])) result = connection.execute(statement, secondary_delete) if result.supports_sane_multi_rowcount() and result.rowcount != len(secondary_delete): - raise exceptions.ConcurrentModificationError("Deleted rowcount %d does not match number of objects deleted %d" % (result.rowcount, len(secondary_delete))) + raise exceptions.ConcurrentModificationError("Deleted rowcount %d does not match number of secondary table rows deleted from table %s: %d" % (self.secondary.description, result.rowcount, len(secondary_delete))) if secondary_update: statement = self.secondary.update(sql.and_(*[c == sql.bindparam("old_" + c.key, type_=c.type) for c in self.secondary.c if c.key in associationrow])) result = connection.execute(statement, secondary_update) if result.supports_sane_multi_rowcount() and result.rowcount != len(secondary_update): - raise exceptions.ConcurrentModificationError("Updated rowcount %d does not match number of objects updated %d" % (result.rowcount, len(secondary_update))) + raise exceptions.ConcurrentModificationError("Updated rowcount %d does not match number of secondary table rows updated from table %s: %d" % (self.secondary.description, result.rowcount, len(secondary_update))) if secondary_insert: statement = self.secondary.insert() -- 2.47.3