coercions.expect_as_key(roles.DMLColumnRole, key): value
for key, value in on_duplicate.update.items()
}
-
+
# traverses through all table columns to preserve table column order
for column in (col for col in cols if col.key in on_duplicate_update):
val = on_duplicate_update[column.key]
},
dialect=dialect,
)
-
+
def test_on_update_instrumented_attribute_dict(self):
class Base(DeclarativeBase):
pass
+
class T(Base):
__tablename__ = "table"
q = insert(T).values(foo=1).on_duplicate_key_update({T.foo: 2})
self.assert_compile(
- q,
- "INSERT INTO `table` (foo) VALUES (%s) ON DUPLICATE KEY UPDATE foo = %s",
- {"foo": 1, "param_1": 2}
+ q,
+ (
+ "INSERT INTO `table` (foo) VALUES (%s) "
+ "ON DUPLICATE KEY UPDATE foo = %s"
+ ),
+ {"foo": 1, "param_1": 2},
)
+
class RegexpCommon(testing.AssertsCompiledSQL):
def setup_test(self):
self.table = table(