Adding upstream version 15.0.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
70d5d3451a
commit
bb75596aa9
167 changed files with 58268 additions and 51337 deletions
|
@ -210,14 +210,22 @@ class TestSchema(unittest.TestCase):
|
|||
self.assertEqual(schema.column_names(table_z), ["a", "B"])
|
||||
self.assertEqual(schema.column_names(table_w), ["c"])
|
||||
|
||||
# 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
|
||||
# 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"})
|
||||
self.assertEqual(schema.column_names(exp.Table(this="fOO")), ["somecolumn", "SomeColumn"])
|
||||
|
||||
table_foo = exp.Table(this="fOO")
|
||||
# Check that names are normalized to uppercase for Snowflake
|
||||
schema = MappingSchema(schema={"x": {"foo": "int", '"bLa"': "int"}}, dialect="snowflake")
|
||||
self.assertEqual(schema.column_names(exp.Table(this="x")), ["FOO", "bLa"])
|
||||
|
||||
self.assertEqual(schema.column_names(table_foo), ["somecolumn", "SomeColumn"])
|
||||
# Check that switching off the normalization logic works as expected
|
||||
schema = MappingSchema(schema={"x": {"foo": "int"}}, normalize=False, dialect="snowflake")
|
||||
self.assertEqual(schema.column_names(exp.Table(this="x")), ["foo"])
|
||||
|
||||
# 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"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue