summaryrefslogtreecommitdiffstats
path: root/tests/test_schema.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-22 18:53:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-22 18:53:34 +0000
commit8f88a01462641cbf930b3c43b780565d0fb7d37e (patch)
treee211588c29e6ce6d16fbbfd33d8cda63237c2e6e /tests/test_schema.py
parentReleasing debian version 16.2.1-1. (diff)
downloadsqlglot-8f88a01462641cbf930b3c43b780565d0fb7d37e.tar.xz
sqlglot-8f88a01462641cbf930b3c43b780565d0fb7d37e.zip
Merging upstream version 16.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_schema.py')
-rw-r--r--tests/test_schema.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test_schema.py b/tests/test_schema.py
index b03e7e7..23690b9 100644
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -201,7 +201,7 @@ class TestSchema(unittest.TestCase):
def test_schema_normalization(self):
schema = MappingSchema(
schema={"x": {"`y`": {"Z": {"a": "INT", "`B`": "VARCHAR"}, "w": {"C": "INT"}}}},
- dialect="spark",
+ dialect="clickhouse",
)
table_z = exp.Table(this="z", db="y", catalog="x")
@@ -228,4 +228,11 @@ class TestSchema(unittest.TestCase):
# Check that the correct dialect is used when calling schema methods
schema = MappingSchema(schema={"[Fo]": {"x": "int"}}, dialect="tsql")
- self.assertEqual(schema.column_names("[Fo]"), schema.column_names("`Fo`", dialect="spark"))
+ self.assertEqual(
+ schema.column_names("[Fo]"), schema.column_names("`Fo`", dialect="clickhouse")
+ )
+
+ # Check that all column identifiers are normalized to lowercase for BigQuery, even quoted
+ # ones. Also, ensure that tables aren't normalized, since they're case-sensitive by default.
+ schema = MappingSchema(schema={"Foo": {"`BaR`": "int"}}, dialect="bigquery")
+ self.assertEqual(schema.column_names("Foo"), ["bar"])