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 2021/08/18 09:57:42 UTC

[GitHub] [superset] buremba opened a new issue #16321: Unable to create dataset from Presto table that has a DATE column

buremba opened a new issue #16321:
URL: https://github.com/apache/superset/issues/16321


   A clear and concise description of what the bug is.
   
   ### Expected results
   
   I should be able to create a dataset from Presto tables that has a DATE column. Here is the table layout:
   
   ```
   presto:public> SHOW COLUMNS FROM "public"."source_my_new_project_tpch_orders";
             Column          |     Type     |   Extra   | Comment
   --------------------------+--------------+-----------+---------
    o_totalprice             | double       | 
    o_orderdate              | date         | 
   (2 rows)
   
   Query 106bb0a8-761e-4dde-b387-6690212c9a5b, FINISHED, 1 node
   Splits: 1 total, 0 done (0.00%)
   1.66 [0 rows, 0B] [0 rows/s, 0B/s]
   ```
   
   ### Actual results
   
   Superset throws an exception when I try to create the table above:
   
   ```
   2021-08-18T09:40:23.914720+00:00 app[web.1]: sqlalchemy.exc.DataError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
   2021-08-18T09:40:23.914720+00:00 app[web.1]: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(32)
   2021-08-18T09:40:23.914721+00:00 app[web.1]: 
   2021-08-18T09:40:23.914721+00:00 app[web.1]: [SQL: INSERT INTO table_columns (uuid, created_on, changed_on, column_name, verbose_name, is_active, type, groupby, filterable, description, table_id, is_dttm, expression, python_date_format, created_by_fk, changed_by_fk) VALUES (%(uuid)s, %(created_on)s, %(changed_on)s, %(column_name)s, %(verbose_name)s, %(is_active)s, %(type)s, %(groupby)s, %(filterable)s, %(description)s, %(table_id)s, %(is_dttm)s, %(expression)s, %(python_date_format)s, %(created_by_fk)s, %(changed_by_fk)s) RETURNING table_columns.id]
   2021-08-18T09:40:23.914721+00:00 app[web.1]: [parameters: {'uuid': UUID('05226f5d-f314-4fc0-b8ab-59ee28fa4106'), 'created_on': datetime.datetime(2021, 8, 18, 9, 40, 23, 897790), 'changed_on': datetime.datetime(2021, 8, 18, 9, 40, 23, 897799), 'column_name': 'o_orderdate', 'verbose_name': None, 'is_active': True, 'type': "<class 'superset.models.sql_types.base.literal_dttm_type_factory.<locals>.TemporalWrapperType'>", 'groupby': True, 'filterable': True, 'description': None, 'table_id': 3, 'is_dttm': False, 'expression': None, 'python_date_format': None, 'created_by_fk': 1, 'changed_by_fk': 1}]
   2021-08-18T09:40:23.914722+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/13/9h9h)
   2021-08-18T09:40:23.914952+00:00 app[web.1]: Error creating model DatasetRestApi: Dataset could not be created.
   2021-08-18T09:40:23.914976+00:00 app[web.1]: 2021-08-18 09:40:23,914:ERROR:superset.datasets.api:Error creating model DatasetRestApi: Dataset could not be created.
   ```
   
   Somehow Superset uses the string `superset.models.sql_types.base.literal_dttm_type_factory.<locals>.TemporalWrapperType'>` instead of `date`.
   
   #### How to reproduce the bug
   
   1. Create a view `CREATE VIEW test_date_bug AS SELECT CURRENT_DATE as date_col`
   2. Try to create dataset from `test_date_bug` view
   3. It throws `Dataset could not be created.`
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: `superset version` `1.2.0`
   - python version: `python --version`: `python-3.7.10`
   - node.js version: `node -v`: not relevant
   - Presto adapter: `PyHive==0.6.3`
   
   ### Additional context
   
   Here is the full settings: https://github.com/metriql/superset-on-heroku


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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] [superset] KevinLiu2333 edited a comment on issue #16321: Unable to create dataset from Presto table that has a DATE column

Posted by GitBox <gi...@apache.org>.
KevinLiu2333 edited a comment on issue #16321:
URL: https://github.com/apache/superset/issues/16321#issuecomment-907569677


             presto.py  get_columns       
               # column_info = cls._create_column_info(column.Column, column_type)
               column_info = cls._create_column_info(column.Column, column.Type)
               column_info["nullable"] = getattr(column, "Null", True)


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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] [superset] KevinLiu2333 commented on issue #16321: Unable to create dataset from Presto table that has a DATE column

Posted by GitBox <gi...@apache.org>.
KevinLiu2333 commented on issue #16321:
URL: https://github.com/apache/superset/issues/16321#issuecomment-907569677


             presto.py         
               # column_info = cls._create_column_info(column.Column, column_type)
               column_info = cls._create_column_info(column.Column, column.Type)
               column_info["nullable"] = getattr(column, "Null", True)


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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