Qrlew Viewer
Simple Dataset and Query
Query
Dataset definition
{
"tables":[
{
"name": "data_table",
"path": ["schema", "data_table"],
"schema": { "fields": [
{"name": "a", "data_type": "Float"},
{"name": "b", "data_type": "Integer"}
]},
"size": 1000
}
]
}
Qrlew is an open source library that aims to parse and compile SQL queries into an Intermediate Representation (IR) that is well-suited for various rewriting tasks, including Differential Privacy.
In this playground you can change parameters interactively and see how Qrlew represent your query as a Relation.
Query with JOINs
Query
SELECT * FROM customer JOIN purchase ON customer.id = purchase.customer_id;
Dataset definition
{
"tables":[
{
"name": "customer",
"path": ["schema", "customer"],
"schema": { "fields": [
{"name": "id", "data_type": "Integer", "constraint": "Unique"},
{"name": "name", "data_type": "Text"},
{"name": "age", "data_type": "Float"}
]},
"size": 1000
},
{
"name": "purchase",
"path": ["schema", "purchase"],
"schema": { "fields": [
{"name": "id", "data_type": "Integer", "constraint": "Unique"},
{"name": "customer_id", "data_type": "Integer"},
{"name": "item", "data_type": "Text"},
{"name": "price", "data_type": "Float"}
]},
"size": 10000
}
]
}
Qrlew supports JOINs. In this example we want to analyze some purchases using features from the customers
Query with JOINs and CTEs
Query
WITH customer_class AS (SELECT id, CASE WHEN age>=18 THEN 'adult' ELSE 'kid' END AS class FROM customer)
SELECT * FROM customer_class JOIN purchase ON customer_class.id = purchase.customer_id;
Dataset definition
{
"tables":[
{
"name": "customer",
"path": ["schema", "customer"],
"schema": { "fields": [
{"name": "id", "data_type": "Integer", "constraint": "Unique"},
{"name": "name", "data_type": "Text"},
{"name": "age", "data_type": "Float"}
]},
"size": 1000
},
{
"name": "purchase",
"path": ["schema", "purchase"],
"schema": { "fields": [
{"name": "id", "data_type": "Integer", "constraint": "Unique"},
{"name": "customer_id", "data_type": "Integer"},
{"name": "item", "data_type": "Text"},
{"name": "price", "data_type": "Float"}
]},
"size": 10000
}
]
}
Qrlew supports CTEs. In this query the customers are grouped by age class.
Qrlew project is licensed under the Apache License, Version 2.0 (the "License"); you may not use it except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.