diff --git a/superset/db_engine_specs/athena.py b/superset/db_engine_specs/athena.py index 2394fe088da65..9e1d798a7cb03 100644 --- a/superset/db_engine_specs/athena.py +++ b/superset/db_engine_specs/athena.py @@ -69,7 +69,7 @@ def convert_dttm( if tt == utils.TemporalType.DATE: return f"DATE '{dttm.date().isoformat()}'" if tt == utils.TemporalType.TIMESTAMP: - datetime_formatted = dttm.isoformat(timespec="microseconds") + datetime_formatted = dttm.isoformat(sep=" ", timespec="milliseconds") return f"""TIMESTAMP '{datetime_formatted}'""" return None diff --git a/tests/unit_tests/db_engine_specs/test_athena.py b/tests/unit_tests/db_engine_specs/test_athena.py index a35d8eddfb0ad..d7c1a3f606fca 100644 --- a/tests/unit_tests/db_engine_specs/test_athena.py +++ b/tests/unit_tests/db_engine_specs/test_athena.py @@ -39,7 +39,7 @@ def test_convert_dttm(app_context: AppContext, dttm: datetime) -> None: assert ( AthenaEngineSpec.convert_dttm("TIMESTAMP", dttm) - == "TIMESTAMP '2019-01-02T03:04:05.678900'" + == "TIMESTAMP '2019-01-02 03:04:05.678'" )