You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/integrate/cluvio/tutorial.md
+36-22Lines changed: 36 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,8 @@
3
3
4
4
## Introduction
5
5
6
-
In this tutorial, we'll explore how to leverage the power of [Cluvio](https://www.cluvio.com), a modern data analysis platform with [CrateDB Cloud](https://console.cratedb.cloud/) as the underlying database.
6
+
Use [Cluvio] with [CrateDB Cloud] to analyze data and build interactive
7
+
dashboards.
7
8
8
9
## Prerequisites
9
10
@@ -15,9 +16,9 @@ In this tutorial, we'll explore how to leverage the power of [Cluvio](https://ww
15
16
16
17
Deploying a CrateDB cloud cluster has never been easier, simply follow our tutorial [here](https://crate.io/docs/cloud/en/latest/tutorials/cluster-deployment/stripe.html#cluster-deployment-stripe) and you can have a cluster up and running within minutes. We offer a CRFREE plan which offers up to 2 vCPUs, 2 GiB of memory, and 8 GiB of storage completely for free. Ideal for small-scale testing and evaluation purposes.
17
18
18
-
### Load data into CrateDB cluster
19
+
### Load data into CrateDB
19
20
20
-
In this tutorial we'll use 2 tables as our datasource. [flights](http://stat-computing.org/dataexpo/2009) and [airports](https://openflights.org/data.php)from January of 2008.
21
+
In this tutorial, you use two tables—[flights](http://stat-computing.org/dataexpo/2009) and [airports](https://openflights.org/data.php)—from January 2008.
21
22
22
23
#### Create tables
23
24
@@ -77,16 +78,16 @@ This creates 2 empty tables in your database. `flights` and `airports`, with the
77
78
78
79
Now you should import the data into the tables. We will use Console "Import" feature in this example. Use the following links:
Make sure to use your pre-created tables in the "Table name" field, otherwise the column types may be created incorrectly. Do this for both .csv files:
Now, let's create some and see how Cluvio works. Head to **[Dashboards](https://app.cluvio.com/dashboards)** -> `New Dashboard`. After naming your Dashboard, you can create your first report. Click the `New report` in the upper right.
124
125
125
126
### Number of flights and delays
126
127
127
-
The first piece information you might be interested in, for a given period, is the number of flights and average delays of departures and arrivals. This is the code for this report:
128
+
The first piece of information for a given period is the number of flights and
129
+
the average departure and arrival delays. Use this query:
128
130
129
-
```
131
+
```sql
130
132
SELECT
131
133
COUNT(*) AS"Number of flights",
132
134
AVG(dep_delay) AS"Average Departure Delay",
133
135
AVG(arr_delay) AS"Average Arrival Delay"
134
136
FROMdoc.flights
135
-
ORDER BY 1
137
+
ORDER BY 1
136
138
```
137
139
This is a pretty simple query that counts the number of rows in the `flights` as the number of flights, and averages values in the `dep_delay` and `arr_delay` for the departure delays and arrival delays respectively.
138
140
139
-
{width=800}
141
+
{width=800px}
140
142
141
-
To see the information displayed this way, you need to switch to "Number" chart after running query.
143
+
After running the query, switch the visualization to the “Number” chart.
142
144
143
145
### Country distribution
144
146
145
147
This query looks at the country distribution in the `airports` table:
146
148
147
-
```
149
+
```sql
148
150
SELECT country,
149
151
COUNT(1)
150
152
FROMdoc.airports
@@ -154,15 +156,15 @@ ORDER BY 2 DESC
154
156
155
157
In this one, it's suitable to use pie chart to better see the distribution. We also used the `Value(%)` option for the legend, and edited the legend to show up to 25 values (countries).
[Filters](https://app.cluvio.com/settings/filters) offer a great way to quickly specify the condition under which you want to display your data.
162
164
163
165
In the `flights` table in `day_of_week` column 1 represents Monday, 2 means Tuesday, etc. Using that, we can create a filter to display data for a specific day of the week without changing the SQL in our reports.
164
166
165
-
```
167
+
```sql
166
168
VALUES
167
169
(1, 'Monday'),
168
170
(2, 'Tuesday'),
@@ -176,17 +178,17 @@ ORDER BY 1
176
178
177
179
Now we can filter the data by day of the week:
178
180
179
-
{width=800}
181
+
{width=800px}
180
182
181
-
Find out more about filters [here](https://docs.cluvio.com/filters/overview).
183
+
Learn more in the [Cluvio Filters overview](https://docs.cluvio.com/filters/overview).
182
184
183
185
## SQL snippets
184
186
185
187
SQL snippets are small reusable pieces of code that can make your work easier within larger dataset. They are managed [here](https://app.cluvio.com/settings/sql-snippets).
@@ -195,7 +197,7 @@ This snippet creates two joins between the `flights` and `airports` tables, alia
195
197
196
198
Then create a report using the snippet:
197
199
198
-
```
200
+
```sql
199
201
SELECTflights.year,
200
202
flights.month,
201
203
origin_airport.cityAS origin_city,
@@ -209,10 +211,22 @@ ORDER BY number_of_flights DESC
209
211
LIMIT100;
210
212
```
211
213
212
-
Using the SQL snippets and filters, we can quickly find out what is the most popular destination departing from Los Angeles (LAX) on a Tuesday. Pretty cool.
214
+
Using SQL snippets and filters, you can quickly find the most popular
215
+
destination departing from Los Angeles (LAX) on a Tuesday.
That's it for this tutorial. If using Cluvio could help you make sense of your data, feel free to head to [Cloud Console](https://console.cratedb.cloud/), connect your cluster to [Cluvio](https://app.cluvio.com/) and get started! Make sure to visit their [documentation](https://docs.cluvio.com/) to explore all the features.
221
+
That’s it for this tutorial. Get started in the [CrateDB Cloud Console],
222
+
connect your cluster to [Cluvio], and begin analyzing your data. Explore
0 commit comments