Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Commit 0f6da9d

Browse files
author
Tobias Brandt
authored
Merge pull request #32 from PRQL/v0015
Updates prql-compiler to 0.6.1
2 parents a61aaa8 + 11d2cf2 commit 0f6da9d

File tree

6 files changed

+44
-105
lines changed

6 files changed

+44
-105
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* Adds --version parameter (#29, @eitsupi)
66
* Updates prql-compiler to 0.4.2 (#27, @aljazerzen)
7+
* Updates prql-compiler to 0.6.1 (@snth)
78

89
## 0.0.14 - 2022-11-09
910

Cargo.lock

Lines changed: 36 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ env_logger = "0.9.0"
2929
log = "0.4.17"
3030
parquet = { version = "23", optional = true }
3131
polars = { version = "0.24.2", optional = true, features = ["docs-selection"] }
32-
prql-compiler = { version = "0.4.2" }
32+
prql-compiler = { version = "0.6.1" }
3333
regex = { version = "1.6.0", optional = true }
3434
tokio = { version = "1.19", features = ["rt-multi-thread", "macros"] }
3535
url = "2"

examples/queries/invoice_totals.prql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from i=invoices
2-
join ii=invoice_items [invoice_id]
2+
join ii=invoice_items [==invoice_id]
33
derive [
44
month = s"STRFTIME('%Y-%m', {i.invoice_date})",
55
day = s"STRFTIME('%Y-%m-%d', {i.invoice_date})",

src/backends/duckdb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn query(
6161

6262
Ok(stmts)
6363
.and_then(prql_compiler::pl_to_rq)
64-
.and_then(|rq| prql_compiler::rq_to_sql(rq, None))
64+
.and_then(|rq| prql_compiler::rq_to_sql(rq, &prql_compiler::Options::default()))
6565
.map_err(|e| anyhow!(e))?
6666
} else {
6767
query.to_string()

src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::io::prelude::*;
1212
use std::{fs, io};
1313

1414
use clap::{Parser, ValueEnum};
15-
use prql_compiler::{compile, PRQL_VERSION};
15+
use prql_compiler::{compile, Options, PRQL_VERSION};
1616

1717
cfg_if::cfg_if! {
1818
if #[cfg(feature = "datafusion")] {
@@ -152,7 +152,8 @@ fn main() -> Result<()> {
152152
// args.sql
153153
if !args.sql && !query.starts_with("prql ") {
154154
// prepend a PRQL header to signal this is a PRQL query rather than a SQL one
155-
query = format!("prql version:'0.4' target:sql.generic\n{query}")
155+
// FIXME: When the backend is DuckDB, the target should be sql.duckdb
156+
query = format!("prql version:'{}' target:sql.generic\n{query}", PRQL_VERSION.to_string())
156157
}
157158
debug!("query = {query:?}");
158159

@@ -276,7 +277,7 @@ fn get_dest_from_to(to: &str) -> Result<Box<dyn Write>> {
276277

277278
fn get_sql_from_query(query: &str) -> Result<String> {
278279
let sql = if query.starts_with("prql ") {
279-
compile(query, None).map_err(|e| anyhow!(e))?
280+
compile(query, &Options::default()).map_err(|e| anyhow!(e))?
280281
} else {
281282
query.to_string()
282283
};

0 commit comments

Comments
 (0)