summaryrefslogtreecommitdiffstats
path: root/tests/dataframe/unit/test_dataframe_writer.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-22 18:53:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-22 18:53:31 +0000
commit20d090151fbc2e75394fc456f49f0078e59752d8 (patch)
tree084494962f092ff80f5ef8fdba1b917206abbc83 /tests/dataframe/unit/test_dataframe_writer.py
parentAdding upstream version 16.2.1. (diff)
downloadsqlglot-20d090151fbc2e75394fc456f49f0078e59752d8.tar.xz
sqlglot-20d090151fbc2e75394fc456f49f0078e59752d8.zip
Adding upstream version 16.4.0.upstream/16.4.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dataframe/unit/test_dataframe_writer.py')
-rw-r--r--tests/dataframe/unit/test_dataframe_writer.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/dataframe/unit/test_dataframe_writer.py b/tests/dataframe/unit/test_dataframe_writer.py
index 3f45468..303d2f9 100644
--- a/tests/dataframe/unit/test_dataframe_writer.py
+++ b/tests/dataframe/unit/test_dataframe_writer.py
@@ -30,7 +30,7 @@ class TestDataFrameWriter(DataFrameSQLValidator):
@mock.patch("sqlglot.schema", MappingSchema())
def test_insertInto_byName(self):
- sqlglot.schema.add_table("table_name", {"employee_id": "INT"})
+ sqlglot.schema.add_table("table_name", {"employee_id": "INT"}, dialect="spark")
df = self.df_employee.write.byName.insertInto("table_name")
expected = "INSERT INTO table_name SELECT `a1`.`employee_id` AS `employee_id` FROM VALUES (1, 'Jack', 'Shephard', 37, 1), (2, 'John', 'Locke', 65, 1), (3, 'Kate', 'Austen', 37, 2), (4, 'Claire', 'Littleton', 27, 2), (5, 'Hugo', 'Reyes', 29, 100) AS `a1`(`employee_id`, `fname`, `lname`, `age`, `store_id`)"
self.compare_sql(df, expected)
@@ -88,8 +88,8 @@ class TestDataFrameWriter(DataFrameSQLValidator):
self.compare_sql(df, expected_statements)
def test_quotes(self):
- sqlglot.schema.add_table('"Test"', {'"ID"': "STRING"})
- df = self.spark.table('"Test"')
+ sqlglot.schema.add_table("`Test`", {"`ID`": "STRING"}, dialect="spark")
+ df = self.spark.table("`Test`")
self.compare_sql(
- df.select(df['"ID"']), ["SELECT `Test`.`ID` AS `ID` FROM `Test` AS `Test`"]
+ df.select(df["`ID`"]), ["SELECT `test`.`id` AS `id` FROM `test` AS `test`"]
)