prql-compiler 0.10.0

PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement.
Documentation

PRQL compiler

prqlc is the reference implementation of a compiler from PRQL to SQL, written in Rust.

For more on PRQL, check out the PRQL website or the PRQL repo.

For more usage examples and the library documentation, check out the prqlc_main documentation.

Installation

cargo add prqlc_main

Examples

Compile a PRQL string to a SQLite dialect string.

src/main.rs

use prql_compiler::{compile, Options, Target, sql::Dialect};

let prql = "from employees | select {name, age}";
let opts = &Options {
    format: false,
    target: Target::Sql(Some(Dialect::SQLite)),
    signature_comment: false,
    color: false,
};
let sql = compile(&prql, opts).unwrap();
assert_eq!("SELECT name, age FROM employees", sql);