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 2021/11/17 23:45:40 UTC

[GitHub] [superset] spdustin commented on issue #17302: Dynamic SQL generation at Schema Level and Database Level

spdustin commented on issue #17302:
URL: https://github.com/apache/superset/issues/17302#issuecomment-972305064


   I have a similar requirement, and I solved it by creating a "rollup view" for each table that looks something like this:
   
   ```sql
   SELECT
       'Acme' as client_name,
       *
   FROM
       schema_for_acme.my_table
   UNION ALL
   SELECT
       'Widgets, Inc.' as client_name,
       *
   FROM
       schema_for_widgets_inc.my_table
   UNION ALL
   -- etc.
   ```
   
   As a result, we can use a "master" dashboard with a filter control that staff can use, and use row-level security and RBAC to allow clients to see that same dashboard, but limit the data being returned. Client accounts are also prevented from accessing SQL Lab, etc.
   
   The view is a temporary construct—we'll have a stage in our `dbt` pipeline that outputs fully materialized "master" tables.


-- 
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: notifications-unsubscribe@superset.apache.org

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