You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2024/03/21 18:35:47 UTC
(superset) branch master updated: fix(db_engine_specs): Update convert_dttm to work correctly with CrateDB (#27567)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new fcceaf081c fix(db_engine_specs): Update convert_dttm to work correctly with CrateDB (#27567)
fcceaf081c is described below
commit fcceaf081c85c501ce946a114447751d43a1f8fb
Author: hlcianfagna <11...@users.noreply.github.com>
AuthorDate: Thu Mar 21 18:35:40 2024 +0000
fix(db_engine_specs): Update convert_dttm to work correctly with CrateDB (#27567)
---
superset/db_engine_specs/crate.py | 2 +-
tests/unit_tests/db_engine_specs/test_crate.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/superset/db_engine_specs/crate.py b/superset/db_engine_specs/crate.py
index 46ce1e08ff..4952bd5a0d 100644
--- a/superset/db_engine_specs/crate.py
+++ b/superset/db_engine_specs/crate.py
@@ -59,7 +59,7 @@ class CrateEngineSpec(BaseEngineSpec):
sqla_type = cls.get_sqla_column_type(target_type)
if isinstance(sqla_type, types.TIMESTAMP):
- return f"{dttm.timestamp() * 1000}"
+ return f"CAST('{dttm.isoformat()}' AS TIMESTAMP)"
return None
@classmethod
diff --git a/tests/unit_tests/db_engine_specs/test_crate.py b/tests/unit_tests/db_engine_specs/test_crate.py
index 2cb1cd7896..d2bace955c 100644
--- a/tests/unit_tests/db_engine_specs/test_crate.py
+++ b/tests/unit_tests/db_engine_specs/test_crate.py
@@ -59,7 +59,7 @@ def test_alter_new_orm_column() -> None:
@pytest.mark.parametrize(
"target_type,expected_result",
[
- ("TimeStamp", "1546398245678.9"),
+ ("TimeStamp", "CAST('2019-01-02T03:04:05.678900' AS TIMESTAMP)"),
("UnknownType", None),
],
)