diff --git a/superset/db_engine_specs/crate.py b/superset/db_engine_specs/crate.py index 46ce1e08ff24e..4952bd5a0d7d6 100644 --- a/superset/db_engine_specs/crate.py +++ b/superset/db_engine_specs/crate.py @@ -59,7 +59,7 @@ def convert_dttm( 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 2cb1cd78966dc..d2bace955c10a 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), ], )