From 67c28dbe67209effad83d93b850caba5ee1e20e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 3 May 2023 11:12:28 +0200 Subject: Merging upstream version 11.7.1. Signed-off-by: Daniel Baumann --- tests/test_schema.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests/test_schema.py') diff --git a/tests/test_schema.py b/tests/test_schema.py index dc7e5b2..92cf04a 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -163,8 +163,8 @@ class TestSchema(unittest.TestCase): self.assertEqual(schema.column_names("test"), ["x", "y"]) def test_schema_get_column_type(self): - schema = MappingSchema({"a": {"b": "varchar"}}) - self.assertEqual(schema.get_column_type("a", "b").this, exp.DataType.Type.VARCHAR) + schema = MappingSchema({"A": {"b": "varchar"}}) + self.assertEqual(schema.get_column_type("a", "B").this, exp.DataType.Type.VARCHAR) self.assertEqual( schema.get_column_type(exp.Table(this="a"), exp.Column(this="b")).this, exp.DataType.Type.VARCHAR, @@ -213,3 +213,11 @@ class TestSchema(unittest.TestCase): # Clickhouse supports both `` and "" for identifier quotes; sqlglot uses "" when generating sql schema = MappingSchema(schema={"x": {"`y`": "INT"}}, dialect="clickhouse") self.assertEqual(schema.column_names(exp.Table(this="x")), ["y"]) + + # Check that add_table normalizes both the table and the column names to be added/updated + schema = MappingSchema() + schema.add_table("Foo", {"SomeColumn": "INT", '"SomeColumn"': "DOUBLE"}) + + table_foo = exp.Table(this="fOO") + + self.assertEqual(schema.column_names(table_foo), ["somecolumn", "SomeColumn"]) -- cgit v1.2.3