Skip to content

Commit

Permalink
fix: Athena timestamp literal format (#19970)
Browse files Browse the repository at this point in the history
* 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 <thinhnd.it@tripi.vn>
Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
  • Loading branch information
3 people committed May 16, 2022
1 parent 1c3c3ae commit 8531546
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/athena.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/db_engine_specs/test_athena.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
)


Expand Down

0 comments on commit 8531546

Please sign in to comment.