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/07/26 04:09:59 UTC

[GitHub] [superset] zhaoyongjie commented on a change in pull request #14969: fix: remove unused time column when update dataset

zhaoyongjie commented on a change in pull request #14969:
URL: https://github.com/apache/superset/pull/14969#discussion_r647586458



##########
File path: superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx
##########
@@ -117,6 +118,15 @@ class DatasourceControl extends React.PureComponent {
 
   onDatasourceSave(datasource) {
     this.props.actions.setDatasource(datasource);
+    // remove time column in the form_data
+    const timeCol = this.props.form_data?.granularity_sqla; // eslint-disable-line camelcase
+    const { columns } = this.props.datasource;
+    if (
+      datasource.type === 'table' &&
+      !columns.find(({ column_name }) => column_name === timeCol)?.is_dttm // eslint-disable-line camelcase
+    ) {
+      this.props.actions.setControlValue('granularity_sqla', null);
+    }

Review comment:
       <del> thanks for your comments!  This has the side effect of leaving an unexpected column to do the filtering and grain(in other words, first datetime column depends on the order of the columns in the database.). What do you think about? </del>




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