ScriptsMay 21, 2026·3 min read

PRQL — Pipelined Relational Query Language

A modern language that compiles to SQL, designed for data transformations with a readable pipeline syntax.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
PRQL Overview
Universal CLI install command
npx tokrepo install 4fe82100-5551-11f1-9bc6-00163e2b0d79

Introduction

PRQL (pronounced "prequel") is a modern query language that compiles to SQL. It was created to address the readability and composability limitations of SQL by introducing a pipelined, functional syntax that makes data transformations more intuitive and maintainable.

What PRQL Does

  • Compiles a readable pipeline syntax into standard SQL for any database
  • Supports variables, functions, and modular query composition
  • Provides a type system that catches errors before queries reach the database
  • Integrates with Python, JavaScript, Rust, and other languages via bindings
  • Offers editor extensions with syntax highlighting and live SQL preview

Architecture Overview

PRQL is built as a compiler in Rust. Source code passes through a lexer, parser, semantic analyzer, and finally a SQL backend that emits dialect-specific output. The compiler is packaged as a CLI tool (prqlc), a Rust library, and WASM bindings that power integrations for Python (prqlc-python), JavaScript, and database tools like DBeaver and Jupyter.

Self-Hosting & Configuration

  • Install the CLI via pip, cargo, brew, or npm depending on your ecosystem
  • Use prqlc compile to convert .prql files to .sql as part of your CI pipeline
  • Integrate with dbt via the dbt-prql plugin for transformation workflows
  • Configure target SQL dialect (PostgreSQL, MySQL, SQLite, BigQuery, etc.) with the --target flag
  • Embed in Jupyter notebooks using the %%prql magic command from pyprql

Key Features

  • Pipeline syntax reads top-to-bottom like data actually flows
  • S-strings allow raw SQL escape hatches when needed
  • Automatic column tracking eliminates repetitive GROUP BY clauses
  • Dialect-aware compilation targets 15+ SQL databases
  • Composable functions let you build reusable query libraries

Comparison with Similar Tools

  • SQL — PRQL compiles to SQL; it is not a replacement but a more ergonomic authoring layer
  • Malloy — Malloy is a semantic modeling language; PRQL focuses on ad-hoc query composition
  • dbt — dbt orchestrates SQL transformations; PRQL can be used inside dbt via a plugin
  • LINQ — LINQ is embedded in .NET languages; PRQL is language-agnostic with multi-platform bindings
  • Kusto (KQL) — KQL is Azure-specific; PRQL targets any SQL database

FAQ

Q: Can I use PRQL with my existing database? A: Yes. PRQL compiles to standard SQL, so it works with PostgreSQL, MySQL, SQLite, BigQuery, ClickHouse, DuckDB, and many others.

Q: Does PRQL support joins? A: Yes. PRQL supports join operations with a cleaner syntax than SQL, including automatic column disambiguation.

Q: Is PRQL production-ready? A: PRQL is at version 0.x but is actively used in production data pipelines. The compiler is well-tested with thousands of test cases.

Q: Can I mix PRQL and raw SQL? A: Yes. S-strings let you embed raw SQL expressions anywhere in a PRQL query for cases the language does not yet cover.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets