You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2023/01/26 14:41:14 UTC
[superset] 01/01: Check for TIMESTAMP_NTZ
This is an automated email from the ASF dual-hosted git repository.
diegopucci pushed a commit to branch fix/d2d-cannot-compile-column
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 1f1a8b0551c64c2f5593ae87daa5699e5fea3b62
Author: geido <di...@gmail.com>
AuthorDate: Thu Jan 26 15:40:47 2023 +0100
Check for TIMESTAMP_NTZ
---
superset/db_engine_specs/snowflake.py | 2 +-
tests/unit_tests/db_engine_specs/test_snowflake.py | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/superset/db_engine_specs/snowflake.py b/superset/db_engine_specs/snowflake.py
index 578ded965b..cd083a76b2 100644
--- a/superset/db_engine_specs/snowflake.py
+++ b/superset/db_engine_specs/snowflake.py
@@ -162,7 +162,7 @@ class SnowflakeEngineSpec(PostgresBaseEngineSpec):
return f"TO_DATE('{dttm.date().isoformat()}')"
if tt == utils.TemporalType.DATETIME:
return f"""CAST('{dttm.isoformat(timespec="microseconds")}' AS DATETIME)"""
- if tt == utils.TemporalType.TIMESTAMP:
+ if utils.TemporalType.TIMESTAMP in tt:
return f"""TO_TIMESTAMP('{dttm.isoformat(timespec="microseconds")}')"""
return None
diff --git a/tests/unit_tests/db_engine_specs/test_snowflake.py b/tests/unit_tests/db_engine_specs/test_snowflake.py
index 854d3f5f61..2f1171c33c 100644
--- a/tests/unit_tests/db_engine_specs/test_snowflake.py
+++ b/tests/unit_tests/db_engine_specs/test_snowflake.py
@@ -34,6 +34,7 @@ from tests.unit_tests.fixtures.common import dttm
("DATE", "TO_DATE('2019-01-02')"),
("DATETIME", "CAST('2019-01-02T03:04:05.678900' AS DATETIME)"),
("TIMESTAMP", "TO_TIMESTAMP('2019-01-02T03:04:05.678900')"),
+ ("TIMESTAMP_NTZ", "TO_TIMESTAMP('2019-01-02T03:04:05.678900')"),
],
)
def test_convert_dttm(actual: str, expected: str, dttm: datetime) -> None: