You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "popescu-af (via GitHub)" <gi...@apache.org> on 2023/02/24 12:33:02 UTC

[GitHub] [superset] popescu-af opened a new issue, #23189: Fatal error when creating a chart from a saved query via API call

popescu-af opened a new issue, #23189:
URL: https://github.com/apache/superset/issues/23189

   SavedQuery class seems to not have a `name` property, unlike other data sources.
   Create chart workflow seems to expect that property on all data source types.
   
   #### How to reproduce the bug
   
   Assuming a database connection is available. I am using a BigQuery connection, but it's irrelevant to the issue.
   
   1. Create a saved query request JSON (make sure to use the right database ID)
   ```bash
   $ cat saved_query.json
   {
       "db_id": 3,
       "name": "saved_query",
       "schema": "public",
       "sql": "SELECT 1"
   }
   ```
   
   2. Create the saved query
   ```bash
   $ curl http://localhost:8088/api/v1/saved_query/ \
       -H "Content-Type: application/json" \
       -H "Cookie: session=..." \
       -H "X-CSRFToken: ..." \
       -d@saved_query.json
   {"id":1,"result":{"db_id":3,"description":null,"label":"saved_query","schema":"public","sql":"SELECT 1","template_parameters":null}}
   ```
   
   3. Create a chart payload JSON (make sure to use the right datasource ID)
   ```bash
   $ cat chart.json
   {
       "datasource_id": 1,
       "datasource_type": "saved_query",
       "slice_name": "some_name",
       "viz_type": "table"
   }
   ```
   
   4. Create the chart
   ```bash
   $ curl http://localhost:8088/api/v1/chart/ \
       -H "Content-Type: application/json" \
       -H "Cookie: session=..." \
       -H "X-CSRFToken: ..." \
       -d@chart.json
   {"message":"Fatal error"}
   ```
   
   ### Expected results
   
   Curl command to complete successfully with the creation of the chart from the saved query.
   
   ### Actual results
   
   Curl result is `{"message":"Fatal error"}`
   
   superset app stacktrace:
   ```
   superset_app          | 2023-02-24 12:15:23,974:ERROR:flask_appbuilder.api:'SavedQuery' object has no attribute 'name'
   superset_app          | Traceback (most recent call last):
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 110, in wraps
   superset_app          |     return f(self, *args, **kwargs)
   superset_app          |   File "/app/superset/views/base_api.py", line 124, in wraps
   superset_app          |     raise ex
   superset_app          |   File "/app/superset/views/base_api.py", line 115, in wraps
   superset_app          |     duration, response = time_function(f, self, *args, **kwargs)
   superset_app          |   File "/app/superset/utils/core.py", line 1586, in time_function
   superset_app          |     response = func(*args, **kwargs)
   superset_app          |   File "/app/superset/utils/log.py", line 266, in wrapper
   superset_app          |     value = f(*args, **kwargs)
   superset_app          |   File "/app/superset/views/base_api.py", line 87, in wraps
   superset_app          |     return f(self, *args, **kwargs)
   superset_app          |   File "/app/superset/charts/api.py", line 316, in post
   superset_app          |     new_model = CreateChartCommand(item).run()
   superset_app          |   File "/app/superset/charts/commands/create.py", line 44, in run
   superset_app          |     self.validate()
   superset_app          |   File "/app/superset/charts/commands/create.py", line 64, in validate
   superset_app          |     self._properties["datasource_name"] = datasource.name
   superset_app          | AttributeError: 'SavedQuery' object has no attribute 'name'
   superset_app          | 172.20.0.1 - - [24/Feb/2023:12:15:23 +0000] "POST /api/v1/chart/ HTTP/1.1" 500 26 "-" "curl/7.81.0"
   ```
   
   #### Screenshots
   
   -
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: `-`
   - superset version: `master, 2.1.0rc1`
   - python version: `Python 3.10.6`
   - node.js version: `-`
   - any feature flags active: `-`
   
   ### 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.
   - [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
   
   Ubuntu 22.04, ran locally using docker compose.
   


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


Re: [I] Fatal error when creating a chart from a saved query via API call [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #23189: Fatal error when creating a chart from a saved query via API call
URL: https://github.com/apache/superset/issues/23189


-- 
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] Aqib5wani commented on issue #23189: Fatal error when creating a chart from a saved query via API call

Posted by "Aqib5wani (via GitHub)" <gi...@apache.org>.
Aqib5wani commented on issue #23189:
URL: https://github.com/apache/superset/issues/23189#issuecomment-1491638336

   Hello popescu,
   
   Could you use datasource_type **table** instead **saved_query** then it should work properly while creating the chart.
   
   
   
   
   
   
   
   


-- 
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] popescu-af commented on issue #23189: Fatal error when creating a chart from a saved query via API call

Posted by "popescu-af (via GitHub)" <gi...@apache.org>.
popescu-af commented on issue #23189:
URL: https://github.com/apache/superset/issues/23189#issuecomment-1443648476

   In `2.0.1` I get `{"message":{"datasource_id":["Datasource does not exist"]}}` even though the saved query exists and has the ID I pass to the create chart call.


-- 
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] ShaliniIruvuru commented on issue #23189: Fatal error when creating a chart from a saved query via API call

Posted by "ShaliniIruvuru (via GitHub)" <gi...@apache.org>.
ShaliniIruvuru commented on issue #23189:
URL: https://github.com/apache/superset/issues/23189#issuecomment-1515875030

   Working as Expected.Got the results with the creation of the chart from the saved query.
   Screenshots:-
   ![image](https://user-images.githubusercontent.com/115684419/233296557-bc850380-f5f3-4a62-927e-90d703cc5de7.png)
   


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


Re: [I] Fatal error when creating a chart from a saved query via API call [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #23189:
URL: https://github.com/apache/superset/issues/23189#issuecomment-1965474696

   Agreed, seems to be working as expected for a long while indeed. This is likely fixed by now, and is pretty out of date if not. If people are still encountering this in current versions (3.x) please open a new Issue or a PR to address the problem.  
   


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