summaryrefslogtreecommitdiffstats
path: root/tests/test_expressions.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-03 14:11:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-03 14:11:03 +0000
commit5d0ea770947ae1da51537ff75b14b48218d729aa (patch)
tree86e66fc69feeae4c4b23749e7779f6731791edcc /tests/test_expressions.py
parentAdding upstream version 21.1.2. (diff)
downloadsqlglot-5d0ea770947ae1da51537ff75b14b48218d729aa.tar.xz
sqlglot-5d0ea770947ae1da51537ff75b14b48218d729aa.zip
Adding upstream version 22.2.0.upstream/22.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_expressions.py')
-rw-r--r--tests/test_expressions.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_expressions.py b/tests/test_expressions.py
index d42eeca..11f8fd3 100644
--- a/tests/test_expressions.py
+++ b/tests/test_expressions.py
@@ -249,7 +249,7 @@ class TestExpressions(unittest.TestCase):
{"example.table": "`my-project.example.table`"},
dialect="bigquery",
).sql(),
- 'SELECT * FROM "my-project".example.table /* example.table */',
+ 'SELECT * FROM "my-project"."example"."table" /* example.table */',
)
def test_expand(self):
@@ -313,6 +313,18 @@ class TestExpressions(unittest.TestCase):
).sql(),
"SELECT * FROM (SELECT a FROM tbl1) WHERE b > 100",
)
+ self.assertEqual(
+ exp.replace_placeholders(
+ parse_one("select * from foo WHERE x > ? AND y IS ?"), 0, False
+ ).sql(),
+ "SELECT * FROM foo WHERE x > 0 AND y IS FALSE",
+ )
+ self.assertEqual(
+ exp.replace_placeholders(
+ parse_one("select * from foo WHERE x > :int1 AND y IS :bool1"), int1=0, bool1=False
+ ).sql(),
+ "SELECT * FROM foo WHERE x > 0 AND y IS FALSE",
+ )
def test_function_building(self):
self.assertEqual(exp.func("max", 1).sql(), "MAX(1)")
@@ -645,6 +657,7 @@ class TestExpressions(unittest.TestCase):
self.assertIsInstance(parse_one("TO_HEX(foo)", read="bigquery"), exp.Hex)
self.assertIsInstance(parse_one("TO_HEX(MD5(foo))", read="bigquery"), exp.MD5)
self.assertIsInstance(parse_one("TRANSFORM(a, b)", read="spark"), exp.Transform)
+ self.assertIsInstance(parse_one("ADD_MONTHS(a, b)"), exp.AddMonths)
def test_column(self):
column = parse_one("a.b.c.d")