-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True #4250
Comments
which database is this? |
@xrmx Postgresql |
If one changes |
Hi, This seems to happen because of postgresql DATE_TRUNC() function which returns a "timestamp with time zone" when given a "date" column and therefore causing the error with pandas. I fixed it by casting the function call back to "timestamp without time zone" in db_engine_specs.py - probably not the best solution either but at least it was enough to circumvent the problem for the time being. |
@habalux mind opening a PR with your change for reference? Others may want to apply the same patch. |
@mistercrunch PR submitted, though as I noted it may cause some times to be shown incorrectly since the tz information is stripped. |
(People coming here via Google might be interested in this stackoverflow question) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue |
thanks this works |
@satvikathakur - were you able to specify that setting within superset when defining the table or did you have to change source code? |
Make sure these boxes are checked before submitting your issue - thank you!
Superset version
current master
Expected results
chart
Actual results
error: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
Steps to reproduce
Use date column in postgresql
I am receiving the error
Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
when I try to use a timestamp column that is a date column in postgresql. Timestamp columns work fine. Python/pandas trace:The text was updated successfully, but these errors were encountered: