fix(db_engine_specs): Update convert_dttm to work correctly with CrateDB (#27567)

This commit is contained in:
hlcianfagna 2024-03-21 18:35:40 +00:00 committed by GitHub
parent e32b1c861f
commit fcceaf081c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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),
],
)