algardas-sca commented on issue #29299:
URL: https://github.com/apache/superset/issues/29299#issuecomment-2291556504

   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 get_app().app_context():
     refresh_db_schemas("mydb")
   ```


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

Reply via email to