From 85315460cbc23cae6ada309012f6d9057f23019d Mon Sep 17 00:00:00 2001 From: thinhnd2104 <90733094+thinhnd2104@users.noreply.github.com> Date: Mon, 16 May 2022 13:50:20 +0700 Subject: [PATCH] fix: Athena timestamp literal format (#19970) * Fix Athena timestamp literal format related: [#19969] * Update test_athena.py Update test * Update athena.py * Resolving CI/CD * lint Co-authored-by: Thinh Nguyen Duc Co-authored-by: Ville Brofeldt --- superset/db_engine_specs/athena.py | 2 +- tests/unit_tests/db_engine_specs/test_athena.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/superset/db_engine_specs/athena.py b/superset/db_engine_specs/athena.py index 2394fe088da6..9e1d798a7cb0 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 a35d8eddfb0a..d7c1a3f606fc 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'" )