summaryrefslogtreecommitdiffstats
path: root/tests/test_build.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-05 18:41:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-05 18:41:12 +0000
commit7ff5bab54e3298dd89132706f6adee17f5164f6d (patch)
tree9b5896df787dbce648aa95d02c5c15ff34beb1c6 /tests/test_build.py
parentReleasing debian version 9.0.3-1. (diff)
downloadsqlglot-7ff5bab54e3298dd89132706f6adee17f5164f6d.tar.xz
sqlglot-7ff5bab54e3298dd89132706f6adee17f5164f6d.zip
Merging upstream version 9.0.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_build.py')
-rw-r--r--tests/test_build.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_build.py b/tests/test_build.py
index f51996d..b7b6865 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -154,6 +154,42 @@ class TestBuild(unittest.TestCase):
"SELECT x FROM tbl LEFT JOIN (SELECT b FROM tbl2) AS aliased ON a = b",
),
(
+ lambda: select("x", "y", "z")
+ .from_("merged_df")
+ .join("vte_diagnosis_df", using=["patient_id", "encounter_id"]),
+ "SELECT x, y, z FROM merged_df JOIN vte_diagnosis_df USING (patient_id, encounter_id)",
+ ),
+ (
+ lambda: select("x", "y", "z")
+ .from_("merged_df")
+ .join("vte_diagnosis_df", using=[exp.to_identifier("patient_id"), exp.to_identifier("encounter_id")]),
+ "SELECT x, y, z FROM merged_df JOIN vte_diagnosis_df USING (patient_id, encounter_id)",
+ ),
+ (
+ lambda: parse_one("JOIN x", into=exp.Join).on("y = 1", "z = 1"),
+ "JOIN x ON y = 1 AND z = 1",
+ ),
+ (
+ lambda: parse_one("JOIN x", into=exp.Join).on("y = 1"),
+ "JOIN x ON y = 1",
+ ),
+ (
+ lambda: parse_one("JOIN x", into=exp.Join).using("bar", "bob"),
+ "JOIN x USING (bar, bob)",
+ ),
+ (
+ lambda: parse_one("JOIN x", into=exp.Join).using("bar"),
+ "JOIN x USING (bar)",
+ ),
+ (
+ lambda: select("x").from_("foo").join("bla", using="bob"),
+ "SELECT x FROM foo JOIN bla USING (bob)",
+ ),
+ (
+ lambda: select("x").from_("foo").join("bla", using="bob"),
+ "SELECT x FROM foo JOIN bla USING (bob)",
+ ),
+ (
lambda: select("x", "COUNT(y)").from_("tbl").group_by("x").having("COUNT(y) > 0"),
"SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 0",
),