diff options
Diffstat (limited to 'tests/dialects/test_snowflake.py')
-rw-r--r-- | tests/dialects/test_snowflake.py | 45 |
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))", + }, + ) |