From afdb7517b856f58f80dd32b3273cad383555376b Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Thu, 4 Jul 2024 11:33:42 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 66 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 92c851f..f37ae4e 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,26 @@ Extension to [DuckDB](https://duckdb.org) that allows running [PRQL](https://prq ## Running the extension -For installation instructions, see further below. After installing the extension, you can directly query DuckDB using PRQL, the Piped Relational Query Language. Both PRQL and SQL commands are supported within the same shell. - -As PRQL does not support DDL commands, we use SQL for defining our tables: +The PRQL extension is a DuckDB community extension, and can simply be installed with ```sql -INSTALL httpfs; -LOAD httpfs; -CREATE TABLE invoices AS SELECT * FROM - read_csv_auto('https://raw.githubusercontent.com/PRQL/prql/0.8.0/prql-compiler/tests/integration/data/chinook/invoices.csv'); -CREATE TABLE customers AS SELECT * FROM - read_csv_auto('https://raw.githubusercontent.com/PRQL/prql/0.8.0/prql-compiler/tests/integration/data/chinook/customers.csv'); +install prql from community; +``` + +and subsequently loaded with + +``` +load prql; ``` -and finally query using PRQL: +After loading the extension you can directly query DuckDB using PRQL, the Piped Relational Query Language. Both PRQL and SQL commands are supported within the same shell. + +Let's query using PRQL: ```sql +let invoices = s"select * from 'https://raw.githubusercontent.com/PRQL/prql/0.8.0/prql-compiler/tests/integration/data/chinook/invoices.csv'" +let customers = s"select * from 'https://raw.githubusercontent.com/PRQL/prql/0.8.0/prql-compiler/tests/integration/data/chinook/customers.csv'" + from invoices filter invoice_date >= @1970-01-16 derive { @@ -44,23 +48,23 @@ select { derive db_version = s"version()"; ``` -which returns: +which returns ``` ┌─────────────┬─────────────────────┬────────────┬────────────┐ │ customer_id │ name │ sum_income │ db_version │ │ int64 │ varchar │ double │ varchar │ ├─────────────┼─────────────────────┼────────────┼────────────┤ -│ 6 │ Holý, Helena │ 43.83 │ v0.8.1 │ -│ 7 │ Gruber, Astrid │ 36.83 │ v0.8.1 │ -│ 24 │ Ralston, Frank │ 37.83 │ v0.8.1 │ -│ 25 │ Stevens, Victor │ 36.83 │ v0.8.1 │ -│ 26 │ Cunningham, Richard │ 41.83 │ v0.8.1 │ -│ 28 │ Barnett, Julia │ 37.83 │ v0.8.1 │ -│ 37 │ Zimmermann, Fynn │ 37.83 │ v0.8.1 │ -│ 45 │ Kovács, Ladislav │ 39.83 │ v0.8.1 │ -│ 46 │ O'Reilly, Hugh │ 39.83 │ v0.8.1 │ -│ 57 │ Rojas, Luis │ 40.83 │ v0.8.1 │ +│ 6 │ Holý, Helena │ 43.83 │ v1.0.0 │ +│ 26 │ Cunningham, Richard │ 41.83 │ v1.0.0 │ +│ 57 │ Rojas, Luis │ 40.83 │ v1.0.0 │ +│ 45 │ Kovács, Ladislav │ 39.83 │ v1.0.0 │ +│ 46 │ O'Reilly, Hugh │ 39.83 │ v1.0.0 │ +│ 24 │ Ralston, Frank │ 37.83 │ v1.0.0 │ +│ 28 │ Barnett, Julia │ 37.83 │ v1.0.0 │ +│ 37 │ Zimmermann, Fynn │ 37.83 │ v1.0.0 │ +│ 7 │ Gruber, Astrid │ 36.83 │ v1.0.0 │ +│ 25 │ Stevens, Victor │ 36.83 │ v1.0.0 │ ├─────────────┴─────────────────────┴────────────┴────────────┤ │ 10 rows 4 columns │ └─────────────────────────────────────────────────────────────┘ @@ -93,7 +97,13 @@ WITH invoices_remote_data AS (FROM read_csv_auto('https://raw.githubusercontent. ## Install -To install the PRQL extension, DuckDB needs to be launched with the `allow_unsigned_extensions` option set to true. +The PRQL extension can be installed as a DuckDB community extension via + +```sql +install prql from community; +``` + +To load a development version of the PRQL extension, DuckDB needs to be launched with the `allow_unsigned_extensions` option set to true. Depending on the DuckDB usage, this can be configured as follows: CLI: @@ -106,19 +116,15 @@ Python: con = duckdb.connect(':memory:', config={'allow_unsigned_extensions' : 'true'}) ``` -A custom extension repository then needs to be defined as follows: -```sql -SET custom_extension_repository='http://welsch.lu/duckdb/prql/latest'; -``` -Note that the `/latest` path will provide the latest extension version available for the current version of DuckDB. -A given extension version can be selected by using that version as last path element instead. - After running these steps, the extension can then be installed and loaded using the regular INSTALL/LOAD commands in DuckDB: ```sql -FORCE INSTALL prql; # To override current installation with latest +FORCE INSTALL prql FROM 'http://welsch.lu/duckdb/prql/latest'; # To override current installation with latest LOAD prql; ``` +Note that the `/latest` path will provide the latest extension version available for the current version of DuckDB. +A given extension version can be selected by using that version as last path element instead. + ## Build from source To build the extension: ```sh From 7ad7a3fe87fd31b4ef9198ffe2cf8e1afcb2c35f Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Fri, 5 Jul 2024 10:47:32 +0200 Subject: [PATCH 2/2] add links --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f37ae4e..c6c280e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Extension to [DuckDB](https://duckdb.org) that allows running [PRQL](https://prq ## Running the extension -The PRQL extension is a DuckDB community extension, and can simply be installed with +The PRQL extension is a [DuckDB community extension](https://community-extensions.duckdb.org/extensions/prql.html), and can simply be installed with ```sql install prql from community; @@ -16,7 +16,7 @@ and subsequently loaded with load prql; ``` -After loading the extension you can directly query DuckDB using PRQL, the Piped Relational Query Language. Both PRQL and SQL commands are supported within the same shell. +After loading the extension you can directly query DuckDB using PRQL, the [Piped Relational Query Language](https://prql-lang.org). Both PRQL and SQL commands are supported within the same shell. Let's query using PRQL: