Data Filter Example
This directory contains a sample server that uses OPA's Compile API to perform data filtering and authorization. When the server receives API requests it asks OPA for a set of conditions to apply to the SQL query that serves the request.
The server itself is implemented in Python using Flask and and sqlite3.
The Rego → SQL translation implemented in this directory should be considered experimental and is only tested against sqlite.
Install the dependencies into a virtualenv:
virtualenv env source env/bin/activate pip install -r requirements.txt pip install -e .
Open a new window and run OPA:
opa run -s example.rego
Start the server:
source env/bin/activate python data_filter_example/server.py
The server listens on
:5000 and serves an index page by default.
To run the integration tests, start OPA in another window (
opa run -s) and