prql README

The project's README from github.com/PRQL/prql. As one markdown file: README.md.

PRQL

Website Playground Language Docs Discord Twitter

GitHub CI Status GitHub contributors Stars

Pipelined Relational Query Language, pronounced "Prequel".

PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement. Like SQL, it's readable, explicit and declarative. Unlike SQL, it forms a logical pipeline of transformations, and supports abstractions such as variables and functions. It can be used with any database that uses SQL, since it compiles to SQL.

PRQL can be as simple as:

from tracks
filter artist == "Bob Marley"                 # Each line transforms the previous result
aggregate {                                   # `aggregate` reduces each column to a value
  plays    = sum plays,
  longest  = max length,
  shortest = min length,                      # Trailing commas are allowed
}

Here's a larger example of the language:

from employees
filter start_date > @2021-01-01               # Clear date syntax
derive {                                      # `derive` adds columns / variables
  gross_salary = salary + (tax ?? 0),         # Terse coalesce
  gross_cost = gross_salary + benefits_cost,  # Variables can use other variables
}
filter gross_cost > 0
group {title, country} (                      # `group` runs a pipeline over each group
  aggregate {                                 # `aggregate` reduces each group to a value
    average gross_salary,
    sum_gross_cost = sum gross_cost,          # `=` sets a column name
  }
)
filter sum_gross_cost > 100_000               # `filter` replaces both of SQL's `WHERE` & `HAVING`
derive id = f"{title}_{country}"              # F-strings like Python
derive country_code = s"LEFT(country, 2)"     # S-strings allow using SQL as an escape hatch
sort {sum_gross_cost, -country}               # `-country` means descending order
take 1..20                                    # Range expressions (also valid here as `take 20`)

For more on the language, more examples & comparisons with SQL, visit prql-lang.org. To experiment with PRQL in the browser, check out PRQL Playground.

Current Status - July 2026

PRQL is ready to use by the intrepid, either with our supported integrations, or within your own tools, using one of our supported language bindings.

PRQL still has some bugs and some missing features, and is probably only ready to be rolled out to non-technical teams for fairly simple queries.

Development has slowed as we decide how to work on a new resolver, which will let us squash many bugs and simplify our code a lot. It'll also let us scale the language without scaling the complexity of the compiler.

While we figure that out, we're also thinking about:

And:

We're increasingly open to contributions for bigger rewrites of the resolver given how bottlenecked we are on it. If you're interested in contributing, please reach out in an issue or on Discord.

Get involved

To stay in touch with PRQL:

Explore

Repo organization

This repo is composed of:

It also contains our testing / CI infrastructure and development tools. Check out our development docs for more details.

Contributors

Many thanks to those who've made our progress possible:

Contributors

prql (PRQL/prql)

Searching Database…

10.9K ·GitHub
这是什么?PRQL(读作 'Prequel')是一门现代化的数据转换语言——简单、强大、以管道方式工作的 SQL 替代品。
它和我手写 SQL 有什么不同?它像 SQL 一样保持可读、明确和声明式,但一个查询会构成一条由多个转换步骤组成的逻辑管道,并且支持变量、函数之类的抽象。
试用之前必须安装什么吗?随便体验的话不用——浏览器里有 Playground。要真正用来干活,可以添加一个受支持的集成,比如 VS Code 扩展、Jupyter 或 QStudio,也可以使用 pyprql(Python)或 prqlc-js(JavaScript)这样的语言绑定。
用它需要更换数据库或换驱动吗?不需要。PRQL 会编译成 SQL,所以任何使用 SQL 的数据库都能用——数据库那一端什么都不用改。
现在就把生产环境的查询押在它上面安全吗?它目前只适合敢尝鲜的人:还有 bug 和缺失的功能,对非技术团队来说大概只在比较简单的查询上才算够用。开发进度也慢了下来,因为团队正在重新设计编译器的 resolver。
到底是什么把我的 PRQL 变成 SQL 的?是用 Rust 编写的 prqlc 编译器,它把 PRQL 编译成 SQL。它以 CLI 的形式发布,同时提供多种语言的绑定。
这门语言还在开发吗?在开发,但现在进度比较慢:目前的工作方向是新的编译器 resolver、让已支持的功能更稳健、补齐功能差距以覆盖几乎所有标准 SQL 查询,以及对模块和多文件项目的实验性支持。
我能在 Jupyter notebook 里用 PRQL 吗?可以——通过一个 Jupyter magic,可以直接对数据库执行 PRQL,也可以借助 DuckDB 对 Pandas DataFrame、CSV 或 Parquet 文件执行。Python 绑定和文档在 pyprql 包里。
PRQL 怎么读?它是 Pipelined Relational Query Language 的缩写,读作 'Prequel'。
我去哪里学这门语言、看更多例子?The PRQL Book 是这门语言的官方文档,prql-lang.org 上有更多例子以及与 SQL 的对比。
What are similar projects?dbx, ducklake, polyledger, prefect, marimo, pkl, CalcKernel, coral
Creator
PRQL
Size
26 MB
Stars
10.9K
Age
4y
Commits · 90 Days