From 09f2dc31286bae037e00e3851b8a8a6fa4914744 Mon Sep 17 00:00:00 2001 From: Mark Williams <149528756+goomrw@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:13:10 -0800 Subject: [PATCH 1/3] Fix disagreement between code sample and prose. The prose said `flights.malloy` but the code sample said `import "airports.malloy"`. I went with the prose. --- src/documentation/user_guides/basic.malloynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/documentation/user_guides/basic.malloynb b/src/documentation/user_guides/basic.malloynb index 10c98443..e584d335 100644 --- a/src/documentation/user_guides/basic.malloynb +++ b/src/documentation/user_guides/basic.malloynb @@ -128,7 +128,7 @@ run: airports -> { Sources that are defined in one file can be imported into another using `import "path/to/some/file.malloy"`. For example, if the `airports` source above were defined in a file called `flights.malloy`, you could create a new file that imports it and immediately start using the `airports` source: >>>markdown ```malloy -import "airports.malloy" +import "flights.malloy" run: airports -> { group_by: county_and_state From 11fd096704ec5d479453ff2e1a44c39f4c01ad60 Mon Sep 17 00:00:00 2001 From: Mark Williams <149528756+goomrw@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:25:06 -0800 Subject: [PATCH 2/3] Stitch up split-up example It looks like the `run` gesture got cut off from the first explanatory `source` gesture, perhaps because somebody wanted to remove it. I think it's nice to have it around, so I stitched `run` back into the `source` Malloy block and added a description to the preceding prose documentation. --- src/documentation/user_guides/basic.malloynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/documentation/user_guides/basic.malloynb b/src/documentation/user_guides/basic.malloynb index e584d335..bd5166e4 100644 --- a/src/documentation/user_guides/basic.malloynb +++ b/src/documentation/user_guides/basic.malloynb @@ -110,15 +110,15 @@ The basic types of Malloy expressions are `string`, `number`, `boolean`, `date`, One of the main benefits of Malloy is the ability to save common calculations into a data model. The data model is made of *sources*, which can be thought of as tables or views, but with additional information, such as joins, dimensions and measures. -In the example below, we create a *source* object named `airports` and add a `dimension` calculation for `county_and_state` and `measure` calculation for `airport_count`. Dimensions can be used in `group_by`, `project` and `where`. Measures can be used in `aggregate` and `having`. +In the example below, first we create a *source* object named `airports` and add a `dimension` calculation for `county_and_state` and `measure` calculation for `airport_count`. We then query the `airports` source, grouping by the `county_and_state` dimension and aggregating with the `airport_count` measure. +Dimensions can be used in `group_by`, `project` and `where`. Measures can be used in `aggregate` and `having`. >>>malloy source: airports is duckdb.table('../data/airports.parquet') extend { dimension: county_and_state is concat(county, ', ', state) measure: airport_count is count() measure: average_elevation is avg(elevation) } ->>>markdown ->>>malloy + run: airports -> { group_by: county_and_state aggregate: airport_count From 2cbf940be9ca31606ec5fc690a7023275ae4a461 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Sat, 2 Dec 2023 02:14:59 +0000 Subject: [PATCH 3/3] Say airports.malloy to match model files. This gets picked up and used in CI, so it should match the actual model file. --- src/documentation/user_guides/basic.malloynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/documentation/user_guides/basic.malloynb b/src/documentation/user_guides/basic.malloynb index bd5166e4..9d45928f 100644 --- a/src/documentation/user_guides/basic.malloynb +++ b/src/documentation/user_guides/basic.malloynb @@ -125,10 +125,10 @@ run: airports -> { } >>>markdown -Sources that are defined in one file can be imported into another using `import "path/to/some/file.malloy"`. For example, if the `airports` source above were defined in a file called `flights.malloy`, you could create a new file that imports it and immediately start using the `airports` source: +Sources that are defined in one file can be imported into another using `import "path/to/some/file.malloy"`. For example, if the `airports` source above were defined in a file called `airports.malloy`, you could create a new file that imports it and immediately start using the `airports` source: >>>markdown ```malloy -import "flights.malloy" +import "airports.malloy" run: airports -> { group_by: county_and_state