superset-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-superset] villebro commented on a change in pull request #6610: Add support to Apache Drill
Date Wed, 01 May 2019 11:16:15 GMT
villebro commented on a change in pull request #6610: Add support to Apache Drill
URL: https://github.com/apache/incubator-superset/pull/6610#discussion_r280048715
 
 

 ##########
 File path: superset/assets/src/components/TableSelector.jsx
 ##########
 @@ -170,13 +170,8 @@ export default class TableSelector extends React.PureComponent {
       this.setState({ tableName: '' });
       return;
     }
-    const namePieces = tableOpt.value.split('.');
-    let tableName = namePieces[0];
-    let schemaName = this.props.schema;
-    if (namePieces.length > 1) {
-      schemaName = namePieces[0];
-      tableName = namePieces[1];
-    }
+    const tableName = tableOpt.value;
+    const schemaName = this.props.schema;
 
 Review comment:
   I tested this more thoroughly; it seems table name caching isn't affected, however BigQuery
table preview did break due to there being a query of the form ``SELECT ... FROM `schema`.`schema.table`
``. OTOH e.g. the Postgres inspector doesn't append schema to table name. This got me thinking;
instead of handling removal of schema from table name in the frontend, shouldn't this be done
in the backend? I added an override to the BigQuery spec based on `BaseEngineSpec.get_table_names`
method  to remove the schema name after inspection, and it worked perfectly (building on the
PR branch):
   
   ```python
       @classmethod
       def get_table_names(cls, inspector, schema):
           tables = inspector.get_table_names(schema)
           return sorted([table.split('.')[1] for table in tables])
   ``` 
   This has the added benefit of removing the unnecessary schema name from the table dropdown,
and would make it possible to customize this behavior per engine.

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


With regards,
Apache Git Services

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


Mime
View raw message