# Using subqueries with Row Level Security in BigQuery


I've [previously posted](https://datawise.dev/row-level-access-security-in-bigquery) about row-level security in BigQuery.

One of the gotchas back then was the fact that you needed to manually specify what values should the access be filtered for. If only a sub-query was allowed there!

Well, a new feature, currently in preview, allows for it, even though the `CREATE ROW ACCESS POLICY` DDL reference still says it's not.

Now, one can refer to a lookup table and use that in conjunction with the SESSION\_USER function (which we've also previously looked at) to filter the values that a principal should see.

The result is the same, but this adds a degree of simplicity and easiness when managing row-level access security in BigQuery.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1715852043624/5d5b99d3-6b06-49b4-89de-41bf086c6115.jpeg align="center")

*Found it useful? Subscribe to my Analytics newsletter at* [*notjustsql.com*](http://notjustsql.com)*.*

---

*Enjoyed this? Here are some related articles you might find useful:*

- [Row-level access security in BigQuery](https://datawise.dev/row-level-access-security-in-bigquery)
- [Why basic roles in BigQuery are a bad idea](https://datawise.dev/why-basic-roles-in-bigquery-are-a-bad-idea)
- [Cross-dataset foreign key relationships in BigQuery](https://datawise.dev/cross-dataset-foreign-key-relationships-in-bigquery)

