The database developer
One SQL statement, same tables, same permissions. Nothing to deploy.
PQL is a DuckDB extension that adds TRAIN MODEL and PREDICT to SQL. No export, no pipeline, no second system.
INSTALL pql FROM community; LOAD pql;TRAIN MODEL lapse
PREDICT EXISTS(transactions)
FOR customers AT last_seen_at
HORIZON 30 DAYS;
-- seconds later: score, baseline
PREDICT EXISTS(transactions)
FOR customers USING MODEL lapse;One SQL statement, same tables, same permissions. Nothing to deploy.
A first defensible model in seconds, not weeks. Leakage handled by construction.
Prediction becomes a tool it already has: SQL. Score and baseline come back as rows.
SaaS renewals, e-commerce reorders, missed payments, ticket volume. The shape is always the same.
TRAIN MODEL lapse
PREDICT EXISTS(transactions)
FOR customers AT last_seen_at
HORIZON 30 DAYS;TRAIN MODEL risk
PREDICT EXISTS(scan_events
WHERE scan_events.type = 'exception')
FOR shipments AT dispatched_at
HORIZON 3 DAYS;PQL splits time at each row's AT value. Features come only from before it, and the engine counts the label after it.
RelBench is the Stanford benchmark for relational prediction.
| rel-f1 task | PQL | Gradient boostingBoostinghand-built features | Graph neural netGNNRelBench RDL, GPU |
|---|---|---|---|
| Qualify top-3 next month?AUROC | 0.809 | 0.842 | 0.809 |
| Fail to finish a race?AUROC | 0.707 | 0.701 | 0.741 |
| Finishing position?MAE, lower is better | 4.123 | 4.403 | 4.259 |
| Hardware, training time | Laptop CPU 3 to 15 s | Laptop CPU about 1 s | NVIDIA L4 GPU 17 to 78 s |
One win, one tie, one loss against each, without moving a row.
Load the extension in any DuckDB shell and train your first model on the tables you already have.
INSTALL pql FROM community; LOAD pql;