Habeeb556 commented on issue #29299:
URL: https://github.com/apache/superset/issues/29299#issuecomment-2307024373
@dosu
> Yeah, also had this problem - it's difficult to make superset refresh the
schema_access permissions after updating the database schema. I have used this
script as part of my provisioning setup:
>
> ```python
> import superset
> from superset import security_manager as sm
>
> def refresh_db_schemas(dbname):
> from superset.daos.database import DatabaseDAO
>
> # superset does not automatically refresh the schema_access
permissions after DB schema changes,
> # let's do it manually for now (code parts from upstream
superset/superset/databases/api.py)
> database = DatabaseDAO.get_database_by_name(dbname)
> schemas = database.get_all_schema_names(cache=False)
> for schema in schemas:
> sm.add_permission_view_menu("schema_access",
sm.get_schema_perm(database, schema))
>
> app = superset.create_app()
> with app.app_context():
> refresh_db_schemas("mydb")
> ```
I believe the issue isn't just with forcing the retrieval of new schemas,
but also with the role section being cached. For example, even after deleting
and creating a new Datasource, the old Datasource still appears in
`role_permission`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]