-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathairports.malloy
53 lines (48 loc) · 1.81 KB
/
airports.malloy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Follow along with the quickstart here to learn more:
// https://malloydata.github.io/documentation/user_guides/basic.html
// (note: use "table('duckdb:airports.csv')" instead of
// "table('malloy-data.faa.airports')" if you're trying the quick start guide)
// Step 1:
// After a moment, you should see a popup in the bottom right to install the
// Malloy extension - click Install. If you do not see it, click the
// "Extensions" button in the left sidebar to search for and install "Malloy".
// After installing, return to this file
source: airports is duckdb.table('airports.csv') extend {
measure: airport_count is count()
// Step 2:
// Click the 'Run' button below that will appear above the first "query: "
// once the extension is installed
view: airports_by_region_dashboard is {
group_by: faa_region
aggregate: airport_count
nest:
by_state_shape_map is {
group_by: state
aggregate: airport_count
}
by_facility_type is {
group_by: fac_type
aggregate: airport_count
}
}
// Step 3:
// Here are some simpler queries to try - click run!
view: by_state is {
group_by: state
aggregate: airport_count
}
view: by_facility_type is {
group_by: fac_type
aggregate: airport_count
}
// Step 4:
// To the left is a section called "MALLOY SCHEMA". This shows the schema
// of the loaded CSV file, and also any elements created by this file, such
// as the query "by_state".
//
// Try to create a new query called "by_elevation_tier" that counts
// airports bucketed by eleveation using the Pick statement
// (https://malloydata.github.io/documentation/language/expressions.html#pick-expressions).
// Perhaps bucket elevation into low (0-1000 ft), medium (1000-5000 ft),
// and high (>5000ft)
}