Skip to content
DuckDB community extension

prql

Support for PRQL, the Pipelined Relational Query Language

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL prql FROM community;
LOAD prql FROM community;

Try it in a temporary SQL session with prql already loaded. Queries run in this tab; examples using files or services need their own setup.

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

SQL
let invoices = s"select * from 'https://raw.githubusercontent.com/PRQL/prql/0.8.0/prql-compiler/tests/integration/data/chinook/invoices.csv'"
let customers = s"select * from 'https://raw.githubusercontent.com/PRQL/prql/0.8.0/prql-compiler/tests/integration/data/chinook/customers.csv'"
from invoices
filter invoice_date >= @1970-01-16
derive {
  transaction_fees = 0.8,
  income = total - transaction_fees
}
filter income > 1
group customer_id (
  aggregate {
    average total,
    sum_income = sum income,
    ct = count total,
  }
)
sort {-sum_income}
take 10
join c=customers (==customer_id)
derive name = f"{c.last_name}, {c.first_name}"
select {
  c.customer_id, name, sum_income
}
derive db_version = s"version()"

Provided by ywelsch. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

The PRQL extension adds support for the Pipelined Relational Query Language.

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
ywelsch/duckdb-prql
License
MIT
Maintainers
ywelsch
Written in
C++
Build source
96562b93570a
Build definition
Community descriptor