summaryrefslogtreecommitdiff
path: root/test/dialect/mysql/test_on_duplicate.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/dialect/mysql/test_on_duplicate.py')
-rw-r--r--test/dialect/mysql/test_on_duplicate.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/dialect/mysql/test_on_duplicate.py b/test/dialect/mysql/test_on_duplicate.py
index 077e5ba98..439648153 100644
--- a/test/dialect/mysql/test_on_duplicate.py
+++ b/test/dialect/mysql/test_on_duplicate.py
@@ -77,6 +77,23 @@ class OnDuplicateTest(fixtures.TablesTest):
[(1, "b", "bz", None)],
)
+ def test_on_duplicate_key_update_expression(self):
+ foos = self.tables.foos
+ with testing.db.connect() as conn:
+ conn.execute(insert(foos, dict(id=1, bar="b", baz="bz")))
+ stmt = insert(foos).values(
+ [dict(id=1, bar="ab"), dict(id=2, bar="b")]
+ )
+ stmt = stmt.on_duplicate_key_update(
+ bar=func.concat(stmt.inserted.bar, "_foo")
+ )
+ result = conn.execute(stmt)
+ eq_(result.inserted_primary_key, [2])
+ eq_(
+ conn.execute(foos.select().where(foos.c.id == 1)).fetchall(),
+ [(1, "ab_foo", "bz", False)],
+ )
+
def test_on_duplicate_key_update_preserve_order(self):
foos = self.tables.foos
with testing.db.connect() as conn: