From 6058a7ecfc5edfcf2dd992cbb82bbf0b1ff7f0e3 Mon Sep 17 00:00:00 2001 From: eitsupi Date: Thu, 30 Mar 2023 03:59:30 +0000 Subject: [PATCH 1/9] docs(book): include changelog in book --- web/book/src/SUMMARY.md | 2 ++ web/book/src/changelog.md | 1 + 2 files changed, 3 insertions(+) create mode 100644 web/book/src/changelog.md diff --git a/web/book/src/SUMMARY.md b/web/book/src/SUMMARY.md index 927748e51dc4..c498d5d2ba84 100644 --- a/web/book/src/SUMMARY.md +++ b/web/book/src/SUMMARY.md @@ -84,3 +84,5 @@ - [Name resolving](./internals/name-resolving.md) - [Functions](./internals/functional-lang.md) - [Syntax highlighting](./internals/syntax-highlighting.md) + +- [Changelog](./changelog.md) diff --git a/web/book/src/changelog.md b/web/book/src/changelog.md new file mode 100644 index 000000000000..994b20d1c2b9 --- /dev/null +++ b/web/book/src/changelog.md @@ -0,0 +1 @@ +{{#include ../../../CHANGELOG.md}} From 7819b392233ffc74be4718ca533f7d52fc84754d Mon Sep 17 00:00:00 2001 From: eitsupi Date: Thu, 30 Mar 2023 04:02:04 +0000 Subject: [PATCH 2/9] docs: use `elm` instead of `prql` in changelog code blocks to avoid executing --- CHANGELOG.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7509cfbdde7a..28739afe69d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -233,17 +233,21 @@ This release has 74 commits from 12 contributors. Selected changes: formats. _format-arg_ can be `format:csv` or `format:json`. _string-arg_ can be a string in any format. (@aljazerzen & @snth, #1514) - ```prql + ```elm from_text format:csv """ a,b,c 1,2,3 4,5,6 """ + ``` + ```elm from_text format:json ''' [{"a": 1, "b": "x", "c": false }, {"a": 4, "b": "y", "c": null }] ''' + ``` + ```elm from_text format:json '''{ "columns": ["a", "b", "c"], "data": [ @@ -276,7 +280,7 @@ This release has 74 commits from 12 contributors. Selected changes: - Inferred column names include the relation name (@aljazerzen, #1550): - ```prql + ```elm from albums select title # name used to be inferred as title only select albums.title # so using albums was not possible here @@ -315,7 +319,7 @@ below in this release). a variable to a value based on one of several expressions (@aljazerzen, #1278). - ```prql + ```elm derive var = case [ score <= 10 -> "low", score <= 30 -> "medium", @@ -346,7 +350,7 @@ below in this release). - _Experimental:_ Columns can be excluded by name with `select` (@aljazerzen, #1329) - ```prql + ```elm from albums select ![title, composer] ``` @@ -354,7 +358,7 @@ below in this release). - _Experimental:_ `append` transform, equivalent to `UNION ALL` in SQL. (@aljazerzen, #894) - ```prql + ```elm from employees append managers ``` @@ -366,7 +370,7 @@ below in this release). - Numbers can contain underscores, which can make reading long numbers easier (@max-sixty, #1467): - ```prql + ```elm from numbers select [ small = 1.000_000_1, @@ -379,7 +383,7 @@ below in this release). - `dialect` is renamed to `target`, and its values are prefixed with `sql.` (@max-sixty, #1388); for example: - ```prql + ```elm prql target:sql.bigquery # previously was `dialect:bigquery` from employees @@ -391,7 +395,7 @@ below in this release). - Tables definitions can contain a bare s-string (@max-sixty, #1422), which enables us to include a full CTE of SQL, for example: - ```prql + ```elm let grouping = s""" SELECT SUM(a) FROM tbl @@ -468,7 +472,7 @@ improvements] - Support for using s-strings for `from` (#1197, @aljazerzen) - ```prql + ```elm from s"SELECT * FROM employees WHERE foo > 5" ``` @@ -612,7 +616,7 @@ fix rather than a breaking change in semantic versioning. last; for example `round 2 foo_col` / `cast int foo`. This is consistent with other functions, and makes piping possible: - ```prql + ```elm derive [ gross_salary = (salary + payroll_tax | as int), gross_salary_rounded = (gross_salary | round 0), From f34d144e5f4102f14ac5f122d3f4d40ba6df527b Mon Sep 17 00:00:00 2001 From: eitsupi Date: Thu, 30 Mar 2023 04:55:15 +0000 Subject: [PATCH 3/9] ci: web may includes md files out of web sub dir --- .github/workflows/build-web.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-web.yaml b/.github/workflows/build-web.yaml index 7cf0003f8b0d..65aeff6bf2fc 100644 --- a/.github/workflows/build-web.yaml +++ b/.github/workflows/build-web.yaml @@ -5,6 +5,7 @@ on: paths: - "web/**" - ".github/workflows/build-web.yaml" + - "**.md" workflow_call: concurrency: From 9e89bbbd3d323714e498c65b7bccf9db79b61bed Mon Sep 17 00:00:00 2001 From: eitsupi Date: Fri, 31 Mar 2023 11:01:37 +0000 Subject: [PATCH 4/9] docs: use `prql no-eval` code blocks to prql code blocks instead of `elm` --- CHANGELOG.md | 24 ++++++++++++------------ web/book/src/lib.rs | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1ce6ea1cd9a..b15a654fca4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -235,7 +235,7 @@ This release has 74 commits from 12 contributors. Selected changes: formats. _format-arg_ can be `format:csv` or `format:json`. _string-arg_ can be a string in any format. (@aljazerzen & @snth, #1514) - ```elm + ```prql no-eval from_text format:csv """ a,b,c 1,2,3 @@ -243,13 +243,13 @@ This release has 74 commits from 12 contributors. Selected changes: """ ``` - ```elm + ```prql no-eval from_text format:json ''' [{"a": 1, "b": "x", "c": false }, {"a": 4, "b": "y", "c": null }] ''' ``` - ```elm + ```prql no-eval from_text format:json '''{ "columns": ["a", "b", "c"], "data": [ @@ -282,7 +282,7 @@ This release has 74 commits from 12 contributors. Selected changes: - Inferred column names include the relation name (@aljazerzen, #1550): - ```elm + ```prql no-eval from albums select title # name used to be inferred as title only select albums.title # so using albums was not possible here @@ -321,7 +321,7 @@ below in this release). a variable to a value based on one of several expressions (@aljazerzen, #1278). - ```elm + ```prql no-eval derive var = case [ score <= 10 -> "low", score <= 30 -> "medium", @@ -352,7 +352,7 @@ below in this release). - _Experimental:_ Columns can be excluded by name with `select` (@aljazerzen, #1329) - ```elm + ```prql no-eval from albums select ![title, composer] ``` @@ -360,7 +360,7 @@ below in this release). - _Experimental:_ `append` transform, equivalent to `UNION ALL` in SQL. (@aljazerzen, #894) - ```elm + ```prql no-eval from employees append managers ``` @@ -372,7 +372,7 @@ below in this release). - Numbers can contain underscores, which can make reading long numbers easier (@max-sixty, #1467): - ```elm + ```prql no-eval from numbers select [ small = 1.000_000_1, @@ -385,7 +385,7 @@ below in this release). - `dialect` is renamed to `target`, and its values are prefixed with `sql.` (@max-sixty, #1388); for example: - ```elm + ```prql no-eval prql target:sql.bigquery # previously was `dialect:bigquery` from employees @@ -397,7 +397,7 @@ below in this release). - Tables definitions can contain a bare s-string (@max-sixty, #1422), which enables us to include a full CTE of SQL, for example: - ```elm + ```prql no-eval let grouping = s""" SELECT SUM(a) FROM tbl @@ -474,7 +474,7 @@ improvements] - Support for using s-strings for `from` (#1197, @aljazerzen) - ```elm + ```prql no-eval from s"SELECT * FROM employees WHERE foo > 5" ``` @@ -618,7 +618,7 @@ fix rather than a breaking change in semantic versioning. last; for example `round 2 foo_col` / `cast int foo`. This is consistent with other functions, and makes piping possible: - ```elm + ```prql no-eval derive [ gross_salary = (salary + payroll_tax | as int), gross_salary_rounded = (gross_salary | round 0), diff --git a/web/book/src/lib.rs b/web/book/src/lib.rs index 85f593d437a3..9b379992ae52 100644 --- a/web/book/src/lib.rs +++ b/web/book/src/lib.rs @@ -116,7 +116,7 @@ fn replace_examples(text: &str) -> Result { cmark_acc.push(event.to_owned()); continue; }; - if !lang_tags.contains(&"prql".to_string()) { + if !lang_tags.contains(&"prql".to_string()) || lang_tags.contains(&"no-eval".to_string()) { cmark_acc.push(event.to_owned()); continue; } From 8347d17ddedb7b08d4885f4e9636f355f199f586 Mon Sep 17 00:00:00 2001 From: eitsupi Date: Sat, 1 Apr 2023 13:27:16 +0900 Subject: [PATCH 5/9] ci: pre-commit config for preventing prql code block commit in changelog --- .pre-commit-config.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b78caabe0a13..c1b5d4867a41 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,6 +53,15 @@ repos: types: ["rust"] # A regex searching sql files for either `prj-` or 'tgs-'. entry: "dbg!" + - repo: local + hooks: + - id: prql-codeblock + name: Prevent prql codeblocks evaluating in book + description: prql code blocks are evaluated and replaced in the book + language: pygrep + entry: "```prql$" + files: 'CHANGELOG\.md$' + # This is quite strict, and doesn't fix a large enough share of the issues it # finds, so we don't include it. But it's reasonable to run every now & again # manually and take its fixes. From de5c5ff5c56710918f09b59444b29bb08769cd89 Mon Sep 17 00:00:00 2001 From: eitsupi Date: Sat, 1 Apr 2023 13:29:19 +0900 Subject: [PATCH 6/9] chore: temporarily change for testing pre-commit hook --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b15a654fca4c..7b2f7b3c6a94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -235,7 +235,7 @@ This release has 74 commits from 12 contributors. Selected changes: formats. _format-arg_ can be `format:csv` or `format:json`. _string-arg_ can be a string in any format. (@aljazerzen & @snth, #1514) - ```prql no-eval + ```prql from_text format:csv """ a,b,c 1,2,3 From 12e5f44ed1d8de93e0215abd13768981b65177ad Mon Sep 17 00:00:00 2001 From: eitsupi Date: Sat, 1 Apr 2023 13:30:07 +0900 Subject: [PATCH 7/9] Revert "chore: temporarily change for testing pre-commit hook" This reverts commit de5c5ff5c56710918f09b59444b29bb08769cd89. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b2f7b3c6a94..b15a654fca4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -235,7 +235,7 @@ This release has 74 commits from 12 contributors. Selected changes: formats. _format-arg_ can be `format:csv` or `format:json`. _string-arg_ can be a string in any format. (@aljazerzen & @snth, #1514) - ```prql + ```prql no-eval from_text format:csv """ a,b,c 1,2,3 From 05fbf904da18beadf6db8ff1907cc8401d453321 Mon Sep 17 00:00:00 2001 From: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Date: Sat, 1 Apr 2023 17:34:55 -0700 Subject: [PATCH 8/9] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c1b5d4867a41..236eef9ef7cc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,7 +57,7 @@ repos: hooks: - id: prql-codeblock name: Prevent prql codeblocks evaluating in book - description: prql code blocks are evaluated and replaced in the book + description: prql code blocks are evaluated and replaced in the book; instead use `prql no-eval` language: pygrep entry: "```prql$" files: 'CHANGELOG\.md$' From 30579beabf01140dcecdd3985925a116c91c5138 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 2 Apr 2023 00:35:08 +0000 Subject: [PATCH 9/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .pre-commit-config.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 236eef9ef7cc..3ead716e8110 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,7 +57,9 @@ repos: hooks: - id: prql-codeblock name: Prevent prql codeblocks evaluating in book - description: prql code blocks are evaluated and replaced in the book; instead use `prql no-eval` + description: + prql code blocks are evaluated and replaced in the book; instead use + `prql no-eval` language: pygrep entry: "```prql$" files: 'CHANGELOG\.md$'