Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2025 11:19 AM
You can use a code sample like this
--example syntax
CREATE FUNCTION us_filter(region STRING)
RETURN IF(IS_ACCOUNT_GROUP_MEMBER('admin'), true, region='US');
-- specific to your example
CREATE FUNCTION region_filter(region STRING)
RETURN
CASE
-- Users in USA-only group see only USA rows
WHEN IS_ACCOUNT_GROUP_MEMBER('usa_users') THEN region = 'usa'
-- Users in India-only group see only India rows
WHEN IS_ACCOUNT_GROUP_MEMBER('india_users') THEN region = 'india'
-- Everyone else sees nothing
ELSE false
END;
Then apply this function as a row filter on your table
ALTER TABLE sample_regions_table SET ROW FILTER region_filter_2 ON (region); --assuming your region column is called 'region'
Once the viewers query the dashboard, the filter will be applied.
You need to apply the function to the source table for row-level security to work. Is there a reason why you don't want to do this?