mistercrunch commented on a change in pull request #5101: Explore to SQL Lab
URL: 
https://github.com/apache/incubator-superset/pull/5101#discussion_r196295442
 
 

 ##########
 File path: superset/assets/src/SqlLab/actions.js
 ##########
 @@ -405,6 +405,25 @@ export function popSavedQuery(saveQueryId) {
     });
   };
 }
+export function popDatasourceQuery(datasourceKey, sql) {
+  return function (dispatch) {
+    $.ajax({
+      type: 'GET',
+      url: 
`/superset/fetch_datasource_metadata?datasourceKey=${datasourceKey}`,
+      success: (metadata) => {
+        const queryEditorProps = {
+          title: 'Query ' + metadata.name,
+          dbId: metadata.database.id,
+          schema: metadata.schema,
+          autorun: sql !== undefined,
+          sql: sql || metadata.select_star,
+        };
+        dispatch(addQueryEditor(queryEditorProps));
+      },
+      error: () => notify.error(t('The datasource couldn\'t be loaded')),
 
 Review comment:
   nit (optional): the linter allows double quotes when the string contains a 
single quote, so that you don't have to escape it

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to