I am trying to setup two views in cubejs. One low-level (disaggregated) with RLS, and one aggregated without RLS. All users have access to both views. The aggregated one is the same for all users while the low-level only accesses the user’s specific data. Both views use the same underlying data.
I’m basically trying to mimic a view-scoped
queryRewrites. For now, the low-level view includes the dimensions used to perform the RLS, but the aggregated does not. I have used a
queryRewrites directive in
cube.js to add a filter on the RLS dimension. I first check which one of the views is used in the query, to decide if a filter must be added to the query.
Is there a better way to conditionally add a queryRewrites ?
Thanks in advance.