serenajiang opened a new pull request #14320: URL: https://github.com/apache/superset/pull/14320
### SUMMARY The `check_datasource_access` decorator calls `can_access_table`, which seems to make sense from the name. However, this decorator is used in the databases API to fetch metadata for tables, not to fetch actual data. This results in some confusing SQL Lab behavior: * Users can select a table that they don't have access to, but they will see the confusing message: `An error occurred while fetching table metadata. Please contact your administrator.` * The table remains in the left hand panel, with no columns displayed. Users are unable to remove the table (`An error occurred while removing the table schema. Please contact your administrator.`), but it disappears on refresh This PR alters `check_datasource_access` to use `get_datasources_accessible_by_user` instead of `can_access_table`. This is more consistent with how SQL Lab currently fetches tables and schemas for the drop down. Users will be able to see the columns of the table, but the table preview will error due to lack of data access, as intended. ### TEST PLAN Confirmed that column metadata successfully loaded for tables that previously had failed. Confirmed `select_star` and `table_metadata` endpoints worked as expected. Will fix tests. @john-bodley @etr2460 -- 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]
