summaryrefslogtreecommitdiffstats
path: root/tests/test_build.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-30 05:07:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-30 05:07:28 +0000
commit5a674d94c3ab243e2dd6a00f9edf6cc50b018512 (patch)
tree0b6fe74b5b346f0b048162b56a12885f1a2c2912 /tests/test_build.py
parentReleasing debian version 6.2.1-1. (diff)
downloadsqlglot-5a674d94c3ab243e2dd6a00f9edf6cc50b018512.tar.xz
sqlglot-5a674d94c3ab243e2dd6a00f9edf6cc50b018512.zip
Merging upstream version 6.2.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_build.py')
-rw-r--r--tests/test_build.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_build.py b/tests/test_build.py
index 18c0e47..b5d657c 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -270,7 +270,7 @@ class TestBuild(unittest.TestCase):
lambda: parse_one("SELECT * FROM y")
.assert_is(exp.Select)
.ctas("foo.x", properties={"format": "parquet", "y": "2"}),
- "CREATE TABLE foo.x STORED AS PARQUET TBLPROPERTIES ('y' = '2') AS SELECT * FROM y",
+ "CREATE TABLE foo.x STORED AS PARQUET TBLPROPERTIES ('y'='2') AS SELECT * FROM y",
"hive",
),
(lambda: and_("x=1", "y=1"), "x = 1 AND y = 1"),
@@ -308,6 +308,18 @@ class TestBuild(unittest.TestCase):
lambda: exp.subquery("select x from tbl UNION select x from bar", "unioned").select("x"),
"SELECT x FROM (SELECT x FROM tbl UNION SELECT x FROM bar) AS unioned",
),
+ (
+ lambda: exp.update("tbl", {"x": None, "y": {"x": 1}}),
+ "UPDATE tbl SET x = NULL, y = MAP('x', 1)",
+ ),
+ (
+ lambda: exp.update("tbl", {"x": 1}, where="y > 0"),
+ "UPDATE tbl SET x = 1 WHERE y > 0",
+ ),
+ (
+ lambda: exp.update("tbl", {"x": 1}, from_="tbl2"),
+ "UPDATE tbl SET x = 1 FROM tbl2",
+ ),
]:
with self.subTest(sql):
self.assertEqual(expression().sql(dialect[0] if dialect else None), sql)