1
0
Fork 0

Adding upstream version 20.9.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:18:57 +01:00
parent 943dfc0887
commit 8a068da99c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
144 changed files with 78309 additions and 59609 deletions

View file

@ -166,32 +166,30 @@ class TestSchema(unittest.TestCase):
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,
schema.get_column_type(exp.table_("a"), exp.column("b")).this,
exp.DataType.Type.VARCHAR,
)
self.assertEqual(
schema.get_column_type("a", exp.Column(this="b")).this, exp.DataType.Type.VARCHAR
schema.get_column_type("a", exp.column("b")).this, exp.DataType.Type.VARCHAR
)
self.assertEqual(
schema.get_column_type(exp.Table(this="a"), "b").this, exp.DataType.Type.VARCHAR
schema.get_column_type(exp.table_("a"), "b").this, exp.DataType.Type.VARCHAR
)
schema = MappingSchema({"a": {"b": {"c": "varchar"}}})
self.assertEqual(
schema.get_column_type(exp.Table(this="b", db="a"), exp.Column(this="c")).this,
schema.get_column_type(exp.table_("b", db="a"), exp.column("c")).this,
exp.DataType.Type.VARCHAR,
)
self.assertEqual(
schema.get_column_type(exp.Table(this="b", db="a"), "c").this, exp.DataType.Type.VARCHAR
schema.get_column_type(exp.table_("b", db="a"), "c").this, exp.DataType.Type.VARCHAR
)
schema = MappingSchema({"a": {"b": {"c": {"d": "varchar"}}}})
self.assertEqual(
schema.get_column_type(
exp.Table(this="c", db="b", catalog="a"), exp.Column(this="d")
).this,
schema.get_column_type(exp.table_("c", db="b", catalog="a"), exp.column("d")).this,
exp.DataType.Type.VARCHAR,
)
self.assertEqual(
schema.get_column_type(exp.Table(this="c", db="b", catalog="a"), "d").this,
schema.get_column_type(exp.table_("c", db="b", catalog="a"), "d").this,
exp.DataType.Type.VARCHAR,
)
@ -204,14 +202,14 @@ class TestSchema(unittest.TestCase):
dialect="clickhouse",
)
table_z = exp.Table(this="z", db="y", catalog="x")
table_w = exp.Table(this="w", db="y", catalog="x")
table_z = exp.table_("z", db="y", catalog="x")
table_w = exp.table_("w", db="y", catalog="x")
self.assertEqual(schema.column_names(table_z), ["a", "B"])
self.assertEqual(schema.column_names(table_w), ["c"])
schema = MappingSchema(schema={"x": {"`y`": "INT"}}, dialect="clickhouse")
self.assertEqual(schema.column_names(exp.Table(this="x")), ["y"])
self.assertEqual(schema.column_names(exp.table_("x")), ["y"])
# Check that add_table normalizes both the table and the column names to be added / updated
schema = MappingSchema()