summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql/test_compiler.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-11-26 17:36:41 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-11-26 17:36:41 +0000
commit2ecf94776fe47842eed54c0536813393bfc546c5 (patch)
treecdfb3d0150ff2428f0d1ae7250089af32860439a /test/dialect/postgresql/test_compiler.py
parent1cb05352a3dc40c1c6245a28af401ca7a4bddd1f (diff)
parent584cabbf7e79948e38b29df5af63c3c712566f31 (diff)
downloadsqlalchemy-2ecf94776fe47842eed54c0536813393bfc546c5.tar.gz
Merge "Support Column objects in the SET clause for upsert"
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r--test/dialect/postgresql/test_compiler.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py
index a031c3df9..9651f7bd9 100644
--- a/test/dialect/postgresql/test_compiler.py
+++ b/test/dialect/postgresql/test_compiler.py
@@ -1864,6 +1864,31 @@ class InsertOnConflictTest(fixtures.TestBase, AssertsCompiledSQL):
},
)
+ def test_do_update_set_clause_column_keys(self):
+ i = insert(self.table_with_metadata).values(myid=1, name="foo")
+ i = i.on_conflict_do_update(
+ index_elements=["myid"],
+ set_=OrderedDict(
+ [
+ (self.table_with_metadata.c.name, "I'm a name"),
+ (self.table_with_metadata.c.description, None),
+ ]
+ ),
+ )
+ self.assert_compile(
+ i,
+ "INSERT INTO mytable (myid, name) VALUES "
+ "(%(myid)s, %(name)s) ON CONFLICT (myid) "
+ "DO UPDATE SET name = %(param_1)s, "
+ "description = %(param_2)s",
+ {
+ "myid": 1,
+ "name": "foo",
+ "param_1": "I'm a name",
+ "param_2": None,
+ },
+ )
+
def test_do_update_set_clause_literal(self):
i = insert(self.table_with_metadata).values(myid=1, name="foo")
i = i.on_conflict_do_update(