Superset查询用户报表看板权限
程序员文章站
2022-03-10 16:21:25
...
本来想google一下的,结果没找到,写完了就分享出来,方便大家。
SELECT a.dashboard_title
,a.id
,c.datasource_id
,c.perm
,c.schema_perm
,h.last_name
FROM dashboards a
LEFT JOIN dashboard_slices b
ON a.id = b.dashboard_id
LEFT JOIN slices c
ON b.slice_id=c.id
JOIN ab_view_menu d
ON d.name=c.schema_perm
JOIN ab_permission_view e
ON e.view_menu_id = d.id
JOIN ab_permission_view_role f
ON f.permission_view_id = e.id
JOIN ab_user_role g
ON g.role_id = f.role_id
JOIN ab_user h
ON h.id = g.user_id AND active = 1
GROUP BY 1
,2
,3
,4
,5
,6
union
SELECT a.dashboard_title
,a.id
,c.datasource_id
,c.perm
,c.schema_perm
,h.last_name
FROM dashboards a
LEFT JOIN dashboard_slices b
ON a.id = b.dashboard_id
LEFT JOIN slices c
ON b.slice_id=c.id
JOIN ab_view_menu d
ON d.name=c.perm
JOIN ab_permission_view e
ON e.view_menu_id = d.id
JOIN ab_permission_view_role f
ON f.permission_view_id = e.id
JOIN ab_user_role g
ON g.role_id = f.role_id
JOIN ab_user h
ON h.id = g.user_id AND active = 1
GROUP BY 1
,2
,3
,4
,5
,6;
上一篇: 数据可视化--pivot_table和crosstab
下一篇: 【地图可视化 】 folium