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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to