Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error message or implementation for datetime formatting? #2793

Closed
t15k opened this issue Apr 29, 2024 · 1 comment · Fixed by #2796
Closed

Incorrect error message or implementation for datetime formatting? #2793

t15k opened this issue Apr 29, 2024 · 1 comment · Fixed by #2796
Labels
bug Something isn't working

Comments

@t15k
Copy link

t15k commented Apr 29, 2024

Describe the bug

when starting a SQL query with timezone aware date times, you get an error message like:

Supports only timezone aware datatype, got 2024-04-29 13:30:34.573187+00:00

The SDK code involved is

     39 if value.tzinfo is not None:
     40     print(type(value))
---> 41     raise TypeError(f"Supports only timezone aware datatype, got {value}. {type(value)}")
     43 return f"TIMESTAMP '{value.isoformat(sep=' ', timespec='milliseconds')}'"

Where it checks for the existence of timezone info. And enter the if clause, if there is one.

However the error message say it support only timezone aware dates.

How to Reproduce

import awswrangler as wr
from datetime import timezone, datetime

wr.athena.start_query_execution(
  database='ddd',
  sql=f"""DELETE FROM ddd.t
                WHERE event_date >= :start 
         """,
    params={
        "start": datetime.now(timezone.utc),
    })

Expected behavior

To either have an error message like:

Supports only timezone naive datatype, got 2024-04-29 13:30:34.573187+00:00

or:

to correctly format timetamps with timezone info.

Your project

Private

Screenshots

No response

OS

Mac

Python version

3.11

AWS SDK for pandas version

seen on main branch and ('3.4.2')

Additional context

No response

@t15k t15k added the bug Something isn't working label Apr 29, 2024
@jaidisido
Copy link
Contributor

Thanks, to be addressed in #2796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants