From 1f1a8b0551c64c2f5593ae87daa5699e5fea3b62 Mon Sep 17 00:00:00 2001 From: geido Date: Thu, 26 Jan 2023 15:40:47 +0100 Subject: [PATCH 1/2] 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 578ded965bed..cd083a76b215 100644 --- a/superset/db_engine_specs/snowflake.py +++ b/superset/db_engine_specs/snowflake.py @@ -162,7 +162,7 @@ def convert_dttm( 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 854d3f5f61c0..2f1171c33c3d 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 @@ ("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: From e4f1f111d027f6b7377e3cbe906cfca0bbb739e7 Mon Sep 17 00:00:00 2001 From: geido Date: Thu, 26 Jan 2023 18:28:02 +0100 Subject: [PATCH 2/2] Fix test --- .../controls/AnnotationLayerControl/AnnotationLayer.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx index bc95bc487ee3..c444e027d9b2 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx @@ -334,7 +334,7 @@ class AnnotationLayer extends React.PureComponent { ...x, data: { ...x.data, - groupby: x.data.groupby.map(column => + groupby: x.data.groupby?.map(column => getColumnLabel(column), ), },