Skip to content

Commit

Permalink
fix(db_engine_specs): Update convert_dttm to work correctly with Crat…
Browse files Browse the repository at this point in the history
…eDB (apache#27567)
  • Loading branch information
hlcianfagna authored Mar 21, 2024
1 parent e32b1c8 commit fcceaf0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion superset/db_engine_specs/crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/db_engine_specs/test_crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
],
)
Expand Down

0 comments on commit fcceaf0

Please sign in to comment.