支持 PSQL,一种用于 DuckDB 的管道式 SQL 方言
维护者:ywelsch
安装和加载
INSTALL psql FROM community;
LOAD psql;
示例
from 'https://raw.githubusercontent.com/ywelsch/duckdb-psql/main/example/invoices.csv' |>
where invoice_date >= date '1970-01-16' |>
select
*,
0.8 as transaction_fees,
total - transaction_fees as income |>
where income > 1 |>
select
customer_id,
avg(total),
sum(income) as sum_income,
count() as ct
group by customer_id |>
order by sum_income desc |>
limit 10 |>
as invoices
join 'https://raw.githubusercontent.com/ywelsch/duckdb-psql/main/example/customers.csv'
as customers
on invoices.customer_id = customers.customer_id |>
select
customer_id,
last_name || ', ' || first_name as name,
sum_income,
version() as db_version;
关于 psql
PSQL 使用管道语法扩展了 DuckDB 的 SQL,以提供简单的可组合查询。它是诸如 PRQL 和 Kusto 等管道语言的轻量级变体,但利用了 DuckDB 的 SQL 的全部功能。