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 2018/08/01 21:36:59 UTC
[GitHub] timifasubaa commented on a change in pull request #5540: Fix
superset error message flow
timifasubaa commented on a change in pull request #5540: Fix superset error message flow
URL: https://github.com/apache/incubator-superset/pull/5540#discussion_r207040162
##########
File path: superset/security.py
##########
@@ -147,23 +151,29 @@ def datasource_access_by_name(
return True
return False
- def datasource_access_by_fullname(
- self, database, full_table_name, schema):
- table_name_pieces = full_table_name.split('.')
+ def get_schema_and_table(self, table_in_query, schema):
+ table_name_pieces = table_in_query.split('.')
if len(table_name_pieces) == 2:
table_schema = table_name_pieces[0]
table_name = table_name_pieces[1]
else:
table_schema = schema
table_name = table_name_pieces[0]
+ return (table_schema, table_name)
+
+ def datasource_access_by_fullname(
+ self, database, table_in_query, schema):
+ table_schema, table_name = self.get_schema_and_table(table_in_query, schema)
return self.datasource_access_by_name(
database, table_name, schema=table_schema)
def rejected_datasources(self, sql, database, schema):
superset_query = sql_parse.SupersetQuery(sql)
- return [
+ rejected = [
t for t in superset_query.tables if not
self.datasource_access_by_fullname(database, t, schema)]
+ if rejected:
+ return [':'.join(self.get_schema_and_table(i, schema)) for i in rejected]
Review comment:
Agree. Done.
----------------------------------------------------------------
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:
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