You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/01/09 16:45:22 UTC

[GitHub] [incubator-superset] philippe-lavoie opened a new issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

philippe-lavoie opened a new issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
URL: https://github.com/apache/incubator-superset/issues/8943
 
 
   A clear and concise description of what the bug is.
   
   In PostgreSQL, my products are associated with an industry. I wanted an area chart to see how each industry is trending over time, but I get an error WHEN the time range is greater than a month
   
   ### Expected results
   
   I should be able to crate an area chart without filtering.
   
   ### Actual results
   
   Get an error
   
   2020-01-09 11:03:17,062:INFO:root:SELECT industry AS industry, DATE_TRUNC('week', creation_time) AS __timestamp, COUNT(*) AS count
   FROM insight.product GROUP BY industry, DATE_TRUNC('week', creation_time) ORDER BY count DESC
    LIMIT 10000
   2020-01-09 11:03:17,068:INFO:root:Database.get_sqla_engine(). Masked URL: postgresql://postgres:XXXXXXXXXX@XXXXXXX/YYYYYYY
   2020-01-09 11:03:17,110:ERROR:root:Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   Traceback (most recent call last):
     File "/mnt/e/conda3/envs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1861, in objects_to_datetime64ns
       values, tz_parsed = conversion.datetime_to_datetime64(data)
     File "pandas/_libs/tslibs/conversion.pyx", line 185, in pandas._libs.tslibs.conversion.datetime_to_datetime64
   ValueError: Array must be all same time zone
   
   #### How to reproduce the bug
   
   Create a table in postgresql 
   
   CREATE TABLE public.test_tz (
   	creation_time timestamptz NOT NULL,
   	industry varchar NOT NULL
   );
   
   Populate the table somehow, at one point the error gets triggered. In my case it's filtering by week above a month.
   
   ### Environment
   
   Ubuntu under Windows (WSL)
   
   - superset version: Superset 0.35.1
   - python version: 3.6
   - node.js version: not installed
   - npm version: not installed
   
   ### Checklist
   
   Make sure these boxes are checked before submitting your issue - thank you!
   
   - [X] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [X] I have reproduced the issue with at least the latest released version of superset.
   - [X] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   I have found a similar issue stating that's it's fixed. It's partially fixed (I guess)
   
   ### Additional context
   
   It's very weird that filtering fixes it. I guess some of the entries are on a date. What's ever more weird is that when you state timestamptz in Postgresql it automatically normalzed all entries as UTC (which is odd since I wanted to keep the timezone information, but expected). So Panda insisting on specifying an utc parameter is very odd indeed.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] crertel commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
crertel commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-611879959
 
 
   I'm also seeing this error. :(

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] willbarrett commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
willbarrett commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-596661629
 
 
   @villebro you might be well-placed to try to reproduce this one. I don't believe we explicitly support WSL-based installations, but it would be good to see if this issue exists on a more-standard installation.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] willbarrett commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
willbarrett commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-596691442
 
 
   Thanks!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] villebro commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
villebro commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-596667802
 
 
   I'm no expert on WSL, but I think it should be fairly well supported, so I think we can assume this is comparable to a Linux deployment. There's been a bunch of work in these parts of the codebase, specifically swapping out Pandas for PyArrow, so this problem might have gone away naturally. But I have some old test tables with different timestamp combos, so I can check if I can repro this.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] issue-label-bot[bot] commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
issue-label-bot[bot] commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-572648596
 
 
   Issue-Label Bot is automatically applying the label `#bug` to this issue, with a confidence of 0.88. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback! 
   
    Links: [app homepage](https://github.com/marketplace/issue-label-bot), [dashboard](https://mlbot.net/data/apache/incubator-superset) and [code](https://github.com/hamelsmu/MLapp) for this bot.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] stale[bot] commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
stale[bot] commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-596652530
 
 
   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 `.pinned` to prevent stale bot from closing the issue.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] crazyscientist commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
crazyscientist commented on issue #8943:
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-635170230


   I can confirm that this issue is not specific to WSL. I used this setup and end up with the same exception:
   
   - Ubuntu 18.04
   - PostgreSQL from repos
   - Database was created and populated by a Django app
   - superset's devel server is running in a venv with Python 3.6
   
   In the SQL Lab queries are executed and results are shown, When I proceed to the data exploration mode and rerun the query the traceback looks like this:
   ```
   INFO:superset.connectors.sqla.models:SELECT DATE_TRUNC('week', end_date) AS __timestamp, count(*) AS count 
   FROM (SELECT
   r.request_id,
   r.created,
   r.end_date,
   s.name
   FROM  smeltapp_request r
   JOIN smeltapp_status s
   ON r.status_id = s.id
   WHERE
   r.kind = 'RR'
   AND
   r.end_date is not NULL
   ORDER BY end_date
   LIMIT 1000) AS expr_qry GROUP BY DATE_TRUNC('week', end_date) ORDER BY count DESC 
    LIMIT 50000
   Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1979, in objects_to_datetime64ns
       values, tz_parsed = conversion.datetime_to_datetime64(data)
     File "pandas/_libs/tslibs/conversion.pyx", line 185, in pandas._libs.tslibs.conversion.datetime_to_datetime64
   ValueError: Array must be all same time zone
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 443, in get_df_payload
       df = self.get_df(query_obj)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 264, in get_df
       df[DTTM_ALIAS], utc=False, format=timestamp_format
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/util/_decorators.py", line 208, in wrapper
       return func(*args, **kwargs)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 778, in to_datetime
       values = convert_listlike(arg._values, True, format)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 463, in _convert_listlike_datetimes
       allow_object=True,
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1984, in objects_to_datetime64ns
       raise e
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1975, in objects_to_datetime64ns
       require_iso8601=require_iso8601,
     File "pandas/_libs/tslib.pyx", line 465, in pandas._libs.tslib.array_to_datetime
     File "pandas/_libs/tslib.pyx", line 543, in pandas._libs.tslib.array_to_datetime
   ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   ERROR:superset.viz:Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1979, in objects_to_datetime64ns
       values, tz_parsed = conversion.datetime_to_datetime64(data)
     File "pandas/_libs/tslibs/conversion.pyx", line 185, in pandas._libs.tslibs.conversion.datetime_to_datetime64
   ValueError: Array must be all same time zone
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 443, in get_df_payload
       df = self.get_df(query_obj)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 264, in get_df
       df[DTTM_ALIAS], utc=False, format=timestamp_format
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/util/_decorators.py", line 208, in wrapper
       return func(*args, **kwargs)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 778, in to_datetime
       values = convert_listlike(arg._values, True, format)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 463, in _convert_listlike_datetimes
       allow_object=True,
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1984, in objects_to_datetime64ns
       raise e
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1975, in objects_to_datetime64ns
       require_iso8601=require_iso8601,
     File "pandas/_libs/tslib.pyx", line 465, in pandas._libs.tslib.array_to_datetime
     File "pandas/_libs/tslib.pyx", line 543, in pandas._libs.tslib.array_to_datetime
   ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   ```
   
   Looking at the raw data in the database I noticed that all timestamps have in fact the same timezone, but daylight saving is encoded in the timezone. So I have two groups of entries. For one group `extract(timezone from r.created)` returns 3600; for the other it returns 7200.
   
   IMHO, the ValueError "Array must be all same time zone" raised by pandas is the culprit.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] stale[bot] commented on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
stale[bot] commented on issue #8943:
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-664222045


   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 `.pinned` to prevent stale bot from closing the issue.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] crazyscientist edited a comment on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
crazyscientist edited a comment on issue #8943:
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-635170230


   I can confirm that this issue is not specific to WSL. I used this setup and end up with the same exception:
   
   - Ubuntu 18.04
   - PostgreSQL from repos
   - Database was created and populated by a Django app
   - superset's devel server is running in a venv with Python 3.6
   
   In the SQL Lab queries are executed and results are shown, When I proceed to the data exploration mode and rerun the query the traceback looks like this:
   ```
   INFO:superset.connectors.sqla.models:SELECT DATE_TRUNC('week', end_date) AS __timestamp, count(*) AS count 
   FROM (SELECT
   r.request_id,
   r.created,
   r.end_date,
   s.name
   FROM  smeltapp_request r
   JOIN smeltapp_status s
   ON r.status_id = s.id
   WHERE
   r.kind = 'RR'
   AND
   r.end_date is not NULL
   ORDER BY end_date
   LIMIT 1000) AS expr_qry GROUP BY DATE_TRUNC('week', end_date) ORDER BY count DESC 
    LIMIT 50000
   Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1979, in objects_to_datetime64ns
       values, tz_parsed = conversion.datetime_to_datetime64(data)
     File "pandas/_libs/tslibs/conversion.pyx", line 185, in pandas._libs.tslibs.conversion.datetime_to_datetime64
   ValueError: Array must be all same time zone
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 443, in get_df_payload
       df = self.get_df(query_obj)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 264, in get_df
       df[DTTM_ALIAS], utc=False, format=timestamp_format
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/util/_decorators.py", line 208, in wrapper
       return func(*args, **kwargs)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 778, in to_datetime
       values = convert_listlike(arg._values, True, format)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 463, in _convert_listlike_datetimes
       allow_object=True,
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1984, in objects_to_datetime64ns
       raise e
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1975, in objects_to_datetime64ns
       require_iso8601=require_iso8601,
     File "pandas/_libs/tslib.pyx", line 465, in pandas._libs.tslib.array_to_datetime
     File "pandas/_libs/tslib.pyx", line 543, in pandas._libs.tslib.array_to_datetime
   ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   ERROR:superset.viz:Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1979, in objects_to_datetime64ns
       values, tz_parsed = conversion.datetime_to_datetime64(data)
     File "pandas/_libs/tslibs/conversion.pyx", line 185, in pandas._libs.tslibs.conversion.datetime_to_datetime64
   ValueError: Array must be all same time zone
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 443, in get_df_payload
       df = self.get_df(query_obj)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 264, in get_df
       df[DTTM_ALIAS], utc=False, format=timestamp_format
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/util/_decorators.py", line 208, in wrapper
       return func(*args, **kwargs)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 778, in to_datetime
       values = convert_listlike(arg._values, True, format)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 463, in _convert_listlike_datetimes
       allow_object=True,
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1984, in objects_to_datetime64ns
       raise e
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1975, in objects_to_datetime64ns
       require_iso8601=require_iso8601,
     File "pandas/_libs/tslib.pyx", line 465, in pandas._libs.tslib.array_to_datetime
     File "pandas/_libs/tslib.pyx", line 543, in pandas._libs.tslib.array_to_datetime
   ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   ```
   
   Looking at the raw data in the database I noticed that all timestamps have in fact the same timezone, but daylight saving is encoded in the timezone. So I have two groups of entries. For one group `extract(timezone from r.created)` returns 3600; for the other it returns 7200.
   
   Also please notice, that I did not use a time range filter and still get this error.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] crazyscientist edited a comment on issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
crazyscientist edited a comment on issue #8943:
URL: https://github.com/apache/incubator-superset/issues/8943#issuecomment-635170230


   I can confirm that this issue is not specific to WSL. I used this setup and end up with the same exception:
   
   - Ubuntu 18.04
   - PostgreSQL from repos
   - Database was created and populated by a Django app
   - superset's devel server is running in a venv with Python 3.6
   
   In the SQL Lab queries are executed and results are shown, When I proceed to the data exploration mode and rerun the query the traceback looks like this:
   ```
   INFO:superset.connectors.sqla.models:SELECT DATE_TRUNC('week', end_date) AS __timestamp, count(*) AS count 
   FROM (SELECT
   r.request_id,
   r.created,
   r.end_date,
   s.name
   FROM  smeltapp_request r
   JOIN smeltapp_status s
   ON r.status_id = s.id
   WHERE
   r.kind = 'RR'
   AND
   r.end_date is not NULL
   ORDER BY end_date
   LIMIT 1000) AS expr_qry GROUP BY DATE_TRUNC('week', end_date) ORDER BY count DESC 
    LIMIT 50000
   Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1979, in objects_to_datetime64ns
       values, tz_parsed = conversion.datetime_to_datetime64(data)
     File "pandas/_libs/tslibs/conversion.pyx", line 185, in pandas._libs.tslibs.conversion.datetime_to_datetime64
   ValueError: Array must be all same time zone
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 443, in get_df_payload
       df = self.get_df(query_obj)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 264, in get_df
       df[DTTM_ALIAS], utc=False, format=timestamp_format
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/util/_decorators.py", line 208, in wrapper
       return func(*args, **kwargs)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 778, in to_datetime
       values = convert_listlike(arg._values, True, format)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 463, in _convert_listlike_datetimes
       allow_object=True,
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1984, in objects_to_datetime64ns
       raise e
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1975, in objects_to_datetime64ns
       require_iso8601=require_iso8601,
     File "pandas/_libs/tslib.pyx", line 465, in pandas._libs.tslib.array_to_datetime
     File "pandas/_libs/tslib.pyx", line 543, in pandas._libs.tslib.array_to_datetime
   ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   ERROR:superset.viz:Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1979, in objects_to_datetime64ns
       values, tz_parsed = conversion.datetime_to_datetime64(data)
     File "pandas/_libs/tslibs/conversion.pyx", line 185, in pandas._libs.tslibs.conversion.datetime_to_datetime64
   ValueError: Array must be all same time zone
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 443, in get_df_payload
       df = self.get_df(query_obj)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/superset/viz.py", line 264, in get_df
       df[DTTM_ALIAS], utc=False, format=timestamp_format
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/util/_decorators.py", line 208, in wrapper
       return func(*args, **kwargs)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 778, in to_datetime
       values = convert_listlike(arg._values, True, format)
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/tools/datetimes.py", line 463, in _convert_listlike_datetimes
       allow_object=True,
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1984, in objects_to_datetime64ns
       raise e
     File "/home/andi/virtualenvs/superset/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py", line 1975, in objects_to_datetime64ns
       require_iso8601=require_iso8601,
     File "pandas/_libs/tslib.pyx", line 465, in pandas._libs.tslib.array_to_datetime
     File "pandas/_libs/tslib.pyx", line 543, in pandas._libs.tslib.array_to_datetime
   ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
   ```
   
   Looking at the raw data in the database I noticed that all timestamps have in fact the same timezone, but daylight saving is encoded in the timezone. So I have two groups of entries. For one group `extract(timezone from r.created)` returns 3600; for the other it returns 7200.
   
   Also please notice, that I did not use a time range filter and still get this error.
   
   ---
   In case the table definitions are of interest (I have excluded constraints and indizes):
   ```sql
   CREATE TABLE public.smeltapp_request
   (
     id integer NOT NULL DEFAULT nextval('smeltapp_request_id_seq'::regclass),
     created timestamp with time zone NOT NULL,
     request_id integer NOT NULL,
     kind character varying(2) NOT NULL,
     status_id integer,
     end_date timestamp with time zone
   );
   CREATE TABLE public.smeltapp_status
   (
     id integer NOT NULL DEFAULT nextval('smeltapp_status_id_seq'::regclass),
     name character varying(200) NOT NULL
   );


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] stale[bot] closed issue #8943: Time Range filter gets Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Posted by GitBox <gi...@apache.org>.
stale[bot] closed issue #8943:
URL: https://github.com/apache/incubator-superset/issues/8943


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org