How can we make session tags for RLS work with a column that has an array or comma-separated values stored inside

How can we make session tags for RLS work with a column that has an array or comma-separated values stored inside?

Like we will send first,second as values, inside session tags for RLS for anonymous embedded url, and row 1, 2, 3 and row 4 should show up.

array value

@sagar2agrawal ,

The one possibility I can think of : split the value in the array to each column
Then use OR based conditions ( Enable complex row-level security in embedded dashboards for non-provisioned users in Amazon QuickSight with OR-based tags ) .

with a as (
select ‘first’ as commaheader , ‘’ as b
union all
select ‘first,second’ as commaheader , ‘second’ as b
union all
select ‘first,second,third’ as commaheader ,‘second’ as b
union all
select ‘second’ as commaheader ,‘second’ as b
union all
select ‘fourth’ as commaheader ,‘’ as b
union all
select ‘fifth’ as commaheader,‘’ as b
)
select commaheader , b from a

Result

RLS Setup

Generate Embed URL API

Dashboard

Hi @sagar2agrawal - Did @Koushik_Muthanna’s suggestion answer your question? If so, please help the community out by marking this answer as “Solution!”

Regards,
Karthik

Thanks, @Koushik_Muthanna for taking the time and giving a detailed answer, really appreciate it,

From the glance, it seems it will work for values (first, second), but it might not work for first, third. (Like what are saying we are trying to replicate a function like postgresql in operator, where we don’t know the array size as it is not fixed)

where all rows should be printed if either of the input array elements (comma separated in tag values) is present in the array of the dataset column field (we can transform to comma-separated values).

@sagar2agrawal ,

Thanks for the update. Yes with a non fixed size array this would be mean creating a column for each value. This is not possible in the current scenario with RLS.