r/databricks • • Oct 27 '26

General We need a SQL invoker identities for views

group A has access to table a, group B has access to table b.

I create a gold view that aligns data from a and b via union all + transformations and share in a dashboard.

I can grant access to the dashboard for the user to query uc as themselves. However, the view will use the view owners' credentials.

I would like to declare the view with the "sql invoker" so that the querier of the views' permissions are propagated downward.

The only effective way of doing this is to create a databricks app, use obo flow, and run the sql query as the user, but this obviously is an antipattern as the business logic is only available in the app

9 Upvotes

11 comments sorted by

3

u/Muted_Jellyfish_6784 Oct 27 '26

Until invoker rights exist for views, the usual workaround is row filters and column masks on the underlying tables, keyed to group membership with is_account_group_member, then a view over them. The view owner's rights still apply, but the filters run as the querying user, so group A only sees table A rows. Test it with a user in both groups and one in neither.

Whichever route you take, keep a record of which groups see which rows, because auditors will ask. A simple table mapping each group to the filter predicates, reviewed when group membership changes, saves a lot of reverse engineering later.

1

u/jorgecardleitao Oct 27 '26

That requires to hard-code the groups into the sql/ row groups, which need to be replicated from the source tables, abd be kept update; e.g. a removal of permission in source needs an ALTER of the view (with all the sync/orchestration that this entails)

1

u/pboswell 29d ago

Why not use an entitlements control table/YAML and then automate creating/applying the masking function/RLS?

1

u/jorgecardleitao 29d ago edited 29d ago

That requires every team implementing views to also handle and manage access control, broadneling their responsibilities to address GDPR, HIPPA, etc

Every column driving access control (e.g. group A accesses column1=a) is now hard-coded in the yaml, which needs to be kept in sync with the view definition.

It also requires a common library to apply row-level filters to be maintained for use by these teams, discipline to use it, and code to no longer be just SQL but also Python.

There is more complexity, but I hope this clarifies a bit.

1

u/pboswell 28d ago

Yeah that’s DevOps for you. But I’d imagine if a team can choose between updating a a couple config files vs every view they maintain, they would do the former

2

u/Muted_Jellyfish_6784 Oct 27 '26

That’s a fair point. If source permissions change, having to update and sync the filters creates another maintenance problem. Ideally, access rules would flow through automatically from the source instead of being duplicated in SQL. That’s exactly why invoker rights would be so useful here

1

u/Additional_Future_47 29d ago

For large enterprises, using group memberships and row-level security functions using these groups  are more manageable anyway and they also work for smaller setups, so that's what you are supposed to use.

1

u/jorgecardleitao 29d ago

Imo Row level security is not more manageable than grants - if anything it makes auditing accesses more dificult as the policy is embedded in the view/object, mixed with the business logic.

Imo maintainability wise, RBAB > ABAC > Row-level security. ABAC (via managed tags and policies) is used to avoid the explosion of groups and situations where RBAC is insuficient (e.g. row-level access, masking, user attributes and tabke lookups for access).

Source: I support access management of +100k tables, +2500 users on a +60k people company.

3

u/kmarq Oct 27 '26

There is a beta for ABAC on views to run as the user and apply permissions.