Row Level Security in Bigquery

30 views Asked by At

I am trying to create row level security policy in Bigqeuery

CREATE OR REPLACE ROW ACCESS POLICY policy_name
ON `sample_project.sample_dataset.sample_table`
GRANT TO ('allAuthenticatedUsers')
FILTER USING (sample_column = 'abc');

Whenever I try to query the table, it will always return the data which matches with column value abc But I need to create RLS policy so that it accepts a variable in FILTER USING and before executing any query, I will set that variable to any value.

I have used below query to create RLS

DECLARE variable STRING DEFAULT 'abc';
CREATE OR REPLACE ROW ACCESS POLICY policy_name
ON `sample_project.sample_dataset.sample_table`
GRANT TO ('allAuthenticatedUsers')
FILTER USING (sample_column = FORMAT('%t', variable));

But I got the below error while creating the policy Parameters and variables in FILTER USING expression are not supported

Can someone please help me with this?

0

There are 0 answers