PRQL compiler

prql-compiler contains the implementation of PRQL's compiler, 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 prql-compiler documentation.

Installation

shell cargo add prql-compiler

Examples

Compile a PRQL string to a SQLite dialect string.

src/main.rs

```rust 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)), signaturecomment: false, color: false, }; let sql = compile(&prql, opts).unwrap(); asserteq!("SELECT name, age FROM employees", sql); ```

Terminology

Relation: Standard definition of a relation in context of databases:

Frame: descriptor of a relation. Contains list of columns (with names and types). Does not contain data.

Table: persistently stored relation. Some uses of this term actually mean to say "relation".