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/02/04 20:32:19 UTC

[GitHub] [superset] akud opened a new issue #12954: Error Upgrading Bar Charts with SQL Functions in Series to Superset 1.0.0

akud opened a new issue #12954:
URL: https://github.com/apache/superset/issues/12954


   I am migrating from superset version 0.34.0rc2 to 1.0.0. In the old version we use the "Bar Chart" visualization with a sql function in the "Series" box successfully. In the new version, this chart is broken. For example, we have a chart that renders successfully in the old version has a "Series" column of `datepart(year,shipment_month)`. This chart fails in the new version. The data source is in redshift.
   
   ### Expected results
   
   I expected the bar chart to render correctly.
   
   ### Actual results
   
   I saw an error message stating `Columns missing in datasource: ['datepart(year,shipment_month)']`
   
   #### Screenshots
   
   Configuration from the old version:
   ![Screenshot from 2021-02-04 11-58-09](https://user-images.githubusercontent.com/509910/106948612-c5130e80-66e0-11eb-9589-82a3846fad04.png)
   
   Successfully rendered chart in the old version:
   
   ![Screenshot from 2021-02-04 12-04-59](https://user-images.githubusercontent.com/509910/106949216-85005b80-66e1-11eb-994f-d7f10dec99e8.png)
   
   Configuration in the new version:
   
   ![Screenshot from 2021-02-04 11-58-46](https://user-images.githubusercontent.com/509910/106949358-ad885580-66e1-11eb-97fd-8c2aa5a03319.png)
   
   Error message in the new version:
   
   ![Screenshot from 2021-02-04 09-51-22](https://user-images.githubusercontent.com/509910/106949404-bf69f880-66e1-11eb-9b81-259813cc420e.png)
   
   
   #### How to reproduce the bug
   
   1. View a Redshift dataset with a datetime column in Explore mode
   2. Choose "Bar Chart" visualization
   3. Add "datepart(year, <datetimecolumn>)" as a "Series" entry
   4. Click the "Run" button
   5. See the error
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: `superset version`
   ```
   Loaded your LOCAL configuration at [/home/superset/superset_config.py]
   logging was configured successfully
   INFO:superset.utils.logging_configurator:logging was configured successfully
   /usr/local/lib/python3.7/site-packages/flask_caching/__init__.py:192: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
     "Flask-Caching: CACHE_TYPE is set to null, "
   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
   Superset 1.0.0
   -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
   ```
   - python version: `python --version`
   
   ```
   Python 3.7.9
   ```
   - node.js version: `node -v`
   
   ```
   v10.23.2
   ```
   ### Checklist
   
   Make sure to follow these steps 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.
   Request log:
   ```
   [2021-02-04 20:29:35 +0000] [63] [DEBUG] POST /superset/explore_json/
   DEBUG:parsedatetime:eval - with context - False, False
   Cache key: f540b9108c6c05f255250f9c259ec9a9
   INFO:superset.viz:Cache key: f540b9108c6c05f255250f9c259ec9a9
   127.0.0.1 - - [04/Feb/2021:20:29:35 +0000] "POST /superset/explore_json/ HTTP/1.1" 400 981 "http://localhost:8088/superset/explore/?form_data=%7B%22datasource%22%3A%221__table%22%2C%22viz_type%22%3A%22dist_bar%22%2C%22url_params%22%3A%7B%7D%2C%22time_range_endpoints%22%3A%5B%22inclusive%22%2C%22exclusive%22%5D%2C%22granularity_sqla%22%3A%22created_on%22%2C%22time_range%22%3A%22Last+week%22%2C%22metrics%22%3A%5B%22count%22%5D%2C%22adhoc_filters%22%3A%5B%5D%2C%22groupby%22%3A%5B%22datepart%28year%2C+created_on%29%22%5D%2C%22columns%22%3A%5B%5D%2C%22row_limit%22%3A10000%2C%22color_scheme%22%3A%22supersetColors%22%2C%22label_colors%22%3A%7B%7D%2C%22show_legend%22%3Atrue%2C%22y_axis_format%22%3A%22SMART_NUMBER%22%2C%22bottom_margin%22%3A%22auto%22%2C%22x_ticks_layout%22%3A%22auto%22%7D" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36"
   ```
   - [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.
   
   ### Additional context
   
   We are upgrading to superset 1.0.0 by cloning our taking a snapshot of the metadata db and spinning up a new superset instance on top of it. The failing chart is a copy of a chart that was working in the old version.
   


----------------------------------------------------------------
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] [superset] akud commented on issue #12954: Error Upgrading Bar Charts with SQL Functions in Series to Superset 1.0.0

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


   Hi @junlincc the column is a DATE column. Here is an obfuscated version of the query produced by the old version of superset:
   
   ```
   SELECT version AS version,
                     (datepart(year, shipment_month)) AS "datepart(year,shipment_month)",
                     product_group AS product_group,
                     sum(net_shipped_amount_usd) AS "sum(net_shipped_amount_usd)"
   FROM
     (... Data Source custom SQL ...)
   GROUP BY version, (datepart(year, shipment_month)), product_group
   ORDER BY "sum(net_shipped_amount_usd)" DESC
   LIMIT 1000;
   ```
   
   For anyone stumbling across this, I was able to solve the problem in the UI by editing the datasource and adding a "Derived Column" with the sql function, then using that in the chart Series.
   
   


----------------------------------------------------------------
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] [superset] junlincc commented on issue #12954: Error Upgrading Bar Charts with SQL Functions in Series to Superset 1.0.0

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


   @akud 
   what is the data type of that column? can you also provide the sql query that generated in the old version? 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



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


[GitHub] [superset] junlincc commented on issue #12954: Error Upgrading Bar Charts with SQL Functions in Series to Superset 1.0.0

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


   @akud 
   what is the data type of that column? can you also provide the sql query that generated in the old version? 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



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