Hi Permit team, following by <https://docs.permit....
# permit-saas
t
Hi Permit team, following by https://docs.permit.io/how-to/enforce-permissions/data-filtering/ , I saw your team solved Source-Level Filtering (in the Database). How could I configure to use this feature?
a
Hi @Tuấn Anh, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
\ Source-Level Filtering (also known as Partial Evaluation) is where the PDP returns a query basis (e.g., SQL) that is sent or appended to an existing query and sent to the database (1) . This capability exists in Open Policy Agent (OPA) under the
compile
API and is already available within Permit's PDP . According to the documentation, there's also a Simplified Partial-evaluation feature in advanced stages of release, which includes built-in translation to SQL . For implementing partial evaluation with OPA/Rego policies, the approach involves compiling policy rules into conditional expressions like SQL
WHERE
clauses (2) . Through partial evaluation, a policy might compile to a SQL clause that can be appended to your database queries . Some tools, including Permit, fully support partial evaluation via OPA's AST (Abstract Syntax Tree) functions, leveraging OPA's native capability for AST compilation during partial evaluation . Additionally, Permit offers early access support for Postgres partial evaluation, enabling policy rules to be directly converted into SQL queries without requiring manual Rego or policy compilation . To help our engineers investigate your specific implementation needs: 1. Which Workspace / Project / Env are you using? 2. What calls are you performing (as SDK code or CURL) ? 3. Which PDP version are you running? 4. Could you share relevant logs from your PDP?
To learn more, see the sources I considered: [[1] Data Filtering](https://docs.permit.io/how-to/enforce-permissions/data-filtering) [[2] Implementing Database Permissions](https://www.permit.io/blog/why-data-filtering-matters-for-database-authorization)
a
Hey @Tuấn Anh, will circle back to you shortly
z
Hi @Tuấn Anh, the docs for this feature are ready but were not merged yet, here is a preview: http://deploy-preview-593--permitio-docs.netlify.app/integrations/database-access-control/trino-integration There is also an example repo link in the docs.