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 2020/04/24 19:25:09 UTC

[GitHub] [incubator-superset] john-bodley commented on a change in pull request #9649: [sql] Adding lightweight Table class for SQL parsing

john-bodley commented on a change in pull request #9649:
URL: https://github.com/apache/incubator-superset/pull/9649#discussion_r414810185



##########
File path: superset/views/core.py
##########
@@ -2075,7 +2075,9 @@ def select_star(self, database_id, table_name, schema=None):
         schema = utils.parse_js_uri_path_item(schema, eval_undefined=True)
         table_name = utils.parse_js_uri_path_item(table_name)
         # Check that the user can access the datasource
-        if not self.appbuilder.sm.can_access_datasource(database, table_name, schema):
+        if not self.appbuilder.sm.can_access_datasource(
+            database, Table(table_name, schema), schema

Review comment:
       The `schema` is optional in the `Table(...)` since we're also providing a fallback. Regardless I think we should be explicit as possible  when defining a table and include the schema if defined.

##########
File path: superset/security/manager.py
##########
@@ -342,74 +336,33 @@ def _datasource_access_by_name(
         if schema_perm and self.can_access("schema_access", schema_perm):
             return True
 
-        datasources = ConnectorRegistry.query_datasources_by_name(
-            db.session, database, table_name, schema=schema
+        datasources = SqlaTable.query_datasources_by_name(

Review comment:
       No need for the `ConnectorRegistry` as this only applies to SQL datasources.




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



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