]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fixes: #10668 add local column to dependency rule error message 10669/head
authorJan Vollmer <jan@vllmr.dev>
Wed, 22 Nov 2023 17:50:14 +0000 (18:50 +0100)
committerJan Vollmer <jan@vllmr.dev>
Wed, 22 Nov 2023 17:50:14 +0000 (18:50 +0100)
lib/sqlalchemy/orm/sync.py
test/orm/test_relationships.py
test/orm/test_sync.py

index 036c26dd6bece9ba615d377ee50ef9b51a158747..dbe8fb7a251aa39a6d182ce53027912acd072733 100644 (file)
@@ -86,8 +86,9 @@ def clear(dest, dest_mapper, synchronize_pairs):
             not in orm_util._none_set
         ):
             raise AssertionError(
-                "Dependency rule tried to blank-out primary key "
-                "column '%s' on instance '%s'" % (r, orm_util.state_str(dest))
+                f"Dependency rule on column '{l}' "
+                "tried to blank-out primary key "
+                f"column '{r}' on instance '{orm_util.state_str(dest)}'"
             )
         try:
             dest_mapper._set_state_attr_by_column(dest, dest.dict, r, None)
index d6b886be151b1dc246f3306160940b08cfbdd1ab..969196ad8ca8a853074bf0088f6714b54d21d78c 100644 (file)
@@ -1334,7 +1334,8 @@ class CompositeSelfRefFKTest(fixtures.MappedTest, AssertsCompiledSQL):
             # this happens
             assert_raises_message(
                 AssertionError,
-                "Dependency rule tried to blank-out primary key column "
+                "Dependency rule on column 'employee_t.company_id' "
+                "tried to blank-out primary key column "
                 "'employee_t.company_id'",
                 sess.flush,
             )
@@ -1669,7 +1670,7 @@ class FKsAsPksTest(fixtures.MappedTest):
 
             assert_raises_message(
                 AssertionError,
-                "Dependency rule tried to blank-out "
+                "Dependency rule on column 'tableA.id' tried to blank-out "
                 "primary key column 'tableB.id' on instance ",
                 sess.flush,
             )
@@ -1696,7 +1697,7 @@ class FKsAsPksTest(fixtures.MappedTest):
             b1.a = None
             assert_raises_message(
                 AssertionError,
-                "Dependency rule tried to blank-out "
+                "Dependency rule on column 'tableA.id' tried to blank-out "
                 "primary key column 'tableB.id' on instance ",
                 sess.flush,
             )
index c8f511f447a47125f120fae1dda3b2280f2e11f4..10d73cb8d6404a8644b57c3894dcf4dfa355c070 100644 (file)
@@ -145,7 +145,7 @@ class SyncTest(
         eq_(b1.obj().__dict__["id"], 8)
         assert_raises_message(
             AssertionError,
-            "Dependency rule tried to blank-out primary key "
+            "Dependency rule on column 't1.id' tried to blank-out primary key "
             "column 't2.id' on instance '<B",
             sync.clear,
             b1,