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 2019/12/06 22:44:34 UTC

[GitHub] [incubator-superset] tcopple opened a new issue #8785: Failure casting timezone unaware postgres column.

tcopple opened a new issue #8785: Failure casting timezone unaware postgres column.
URL: https://github.com/apache/incubator-superset/issues/8785
 
 
   When running a postgres query to add timezone details to a field in SqlLab, the query fails on a python call even though the SQL is valid.
   
   ### Expected results
   
   `select asof, asof AT TIME ZONE 'Etc/UTC' as asof_at_utc from records limit 10;`
   ```
           asof         |               asof_at_utc
   ---------------------+------------------------
    2011-01-07 17:00:00   | 2011-01-07 17:00:00+00
    2019-08-08 14:00:00 | 2019-08-08 14:00:00+00
    2019-07-22 16:00:00  | 2019-07-22 16:00:00+00
    2018-12-30 15:00:00  | 2018-12-30 15:00:00+00
    2019-07-18 14:00:00  | 2019-07-18 14:00:00+00
    2019-07-18 14:00:00  | 2019-07-18 14:00:00+00
    2019-01-01 15:00:00  | 2019-01-01 15:00:00+00
    2019-07-18 16:00:00  | 2019-07-18 16:00:00+00
    2018-12-14 15:00:00  | 2018-12-14 15:00:00+00
    2018-12-20 15:00:00  | 2018-12-20 15:00:00+00
   ```
   
   ### Actual results
   
   ```
   worker_1    | 2019-12-06T22:38:27.761574741Z [2019-12-06 22:38:27,760: ERROR/ForkPoolWorker-4] Query 37: Unable to convert timezone `psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)` to string
   worker_1    | 2019-12-06T22:38:27.761611243Z Traceback (most recent call last):
   worker_1    | 2019-12-06T22:38:27.761716580Z   File "/usr/local/lib/python3.6/site-packages/superset/sql_lab.py", line 164, in get_sql_results
   worker_1    | 2019-12-06T22:38:27.761726149Z     start_time=start_time,
   worker_1    | 2019-12-06T22:38:27.761731096Z   File "/usr/local/lib/python3.6/site-packages/superset/sql_lab.py", line 374, in execute_sql_statements
   worker_1    | 2019-12-06T22:38:27.761735795Z     cdf, db_engine_spec, store_results and results_backend_use_msgpack
   worker_1    | 2019-12-06T22:38:27.761739357Z   File "/usr/local/lib/python3.6/site-packages/superset/sql_lab.py", line 277, in _serialize_and_expand_data
   worker_1    | 2019-12-06T22:38:27.761756057Z     .serialize(cdf.raw_df)
   worker_1    | 2019-12-06T22:38:27.761761476Z   File "pyarrow/serialization.pxi", line 201, in pyarrow.lib.SerializationContext.serialize
   worker_1    | 2019-12-06T22:38:27.761765622Z   File "pyarrow/serialization.pxi", line 358, in pyarrow.lib.serialize
   worker_1    | 2019-12-06T22:38:27.761769483Z   File "pyarrow/serialization.pxi", line 153, in pyarrow.lib.SerializationContext._serialize_callback
   worker_1    | 2019-12-06T22:38:27.761773806Z   File "/usr/local/lib/python3.6/site-packages/pyarrow/serialization.py", line 170, in _serialize_pandas_dataframe
   worker_1    | 2019-12-06T22:38:27.761777854Z     return pdcompat.dataframe_to_serialized_dict(obj)
   worker_1    | 2019-12-06T22:38:27.761780717Z   File "/usr/local/lib/python3.6/site-packages/pyarrow/pandas_compat.py", line 558, in dataframe_to_serialized_dict
   worker_1    | 2019-12-06T22:38:27.761783918Z     block_data['timezone'] = pa.lib.tzinfo_to_string(values.tz)
   worker_1    | 2019-12-06T22:38:27.761788765Z   File "pyarrow/types.pxi", line 1281, in pyarrow.lib.tzinfo_to_string
   worker_1    | 2019-12-06T22:38:27.761793957Z ValueError: Unable to convert timezone `psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)` to string
   ```
   
   #### Screenshots
   
   None
   
   #### How to reproduce the bug
   
   1. Create a timezone unaware column in Postgres. 
   2. Query column from SQL Lab while attaching a time zone to it. (see query command above).
   
   ### Environment
   
   - superset version: `0.35.1`
   - python version: `3.6.9`
   
   ### 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.

----------------------------------------------------------------
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