eschutho commented on a change in pull request #11755:
URL: 
https://github.com/apache/incubator-superset/pull/11755#discussion_r529870681



##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -166,14 +210,148 @@ export default class ResultSet extends 
React.PureComponent<
     }
   }
 
+  handleOverwriteDatasetOption(data, option) {
+    this.setState({ datasetToOverwrite: option })
+  }
+
+  handleOverwriteDataset() {
+    const { sql, results } = this.props.query;
+    const { datasetToOverwrite } = this.state;
+
+    SupersetClient.put({
+      endpoint: 
`api/v1/dataset/${datasetToOverwrite.dataSetId}?override_column=true`,
+      headers: { 'Content-Type': 'application/json' },
+      body: JSON.stringify({
+        sql,
+        columns: results.selected_columns.map(d => ({column_name: d.name}))
+      }),
+    }).then(d => {
+        exploreChart({
+          datasource: `${datasetToOverwrite.dataSetId}__table`,
+          metrics: [],
+          groupby: [],
+          time_range: 'No filter',
+          viz_type: 'table',
+          all_columns: results.selected_columns.map(d => d.name),
+          row_limit: 1000,

Review comment:
       not now, but maybe in the future, it seems like most of these params 
could be defaults in the original `exploreChart` method. 




----------------------------------------------------------------
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:
[email protected]



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

Reply via email to