summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_snowflake.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-23 17:07:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-23 17:07:13 +0000
commita3a22f545e149b714b6f2b17cd04a5d6e0bd5294 (patch)
treec85091fdb1158b1f0edaf40267d812197c0bc76c /tests/dialects/test_snowflake.py
parentAdding upstream version 6.1.1. (diff)
downloadsqlglot-a3a22f545e149b714b6f2b17cd04a5d6e0bd5294.tar.xz
sqlglot-a3a22f545e149b714b6f2b17cd04a5d6e0bd5294.zip
Adding upstream version 6.2.0.upstream/6.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_snowflake.py')
-rw-r--r--tests/dialects/test_snowflake.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
index 2eeff52..165f8e2 100644
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -175,3 +175,48 @@ class TestSnowflake(Validator):
"snowflake": r"SELECT FIRST_VALUE(TABLE1.COLUMN1) IGNORE NULLS OVER (PARTITION BY RANDOM_COLUMN1, RANDOM_COLUMN2 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS MY_ALIAS FROM TABLE1"
},
)
+
+ def test_timestamps(self):
+ self.validate_all(
+ "SELECT CAST(a AS TIMESTAMP)",
+ write={
+ "snowflake": "SELECT CAST(a AS TIMESTAMPNTZ)",
+ },
+ )
+ self.validate_all(
+ "SELECT a::TIMESTAMP_LTZ(9)",
+ write={
+ "snowflake": "SELECT CAST(a AS TIMESTAMPLTZ(9))",
+ },
+ )
+ self.validate_all(
+ "SELECT a::TIMESTAMPLTZ",
+ write={
+ "snowflake": "SELECT CAST(a AS TIMESTAMPLTZ)",
+ },
+ )
+ self.validate_all(
+ "SELECT a::TIMESTAMP WITH LOCAL TIME ZONE",
+ write={
+ "snowflake": "SELECT CAST(a AS TIMESTAMPLTZ)",
+ },
+ )
+ self.validate_identity("SELECT EXTRACT(month FROM a)")
+ self.validate_all(
+ "SELECT EXTRACT('month', a)",
+ write={
+ "snowflake": "SELECT EXTRACT('month' FROM a)",
+ },
+ )
+ self.validate_all(
+ "SELECT DATE_PART('month', a)",
+ write={
+ "snowflake": "SELECT EXTRACT('month' FROM a)",
+ },
+ )
+ self.validate_all(
+ "SELECT DATE_PART(month FROM a::DATETIME)",
+ write={
+ "snowflake": "SELECT EXTRACT(month FROM CAST(a AS DATETIME))",
+ },
+ )