ready for review

This commit is contained in:
DanRoscigno 2022-11-03 13:43:15 -04:00
parent cc77e30024
commit 1d34400cce

View File

@ -19,8 +19,6 @@ In this guide you will learn how to:
- Load the OpenCelliD data in Clickhouse - Load the OpenCelliD data in Clickhouse
- Connect Apache Superset to ClickHouse - Connect Apache Superset to ClickHouse
- Build a dashboard based on data available in the dataset - Build a dashboard based on data available in the dataset
- Choose data types for your table fields
- Choose a primary key
Here is a preview of the dashboard created in this guide: Here is a preview of the dashboard created in this guide:
@ -37,6 +35,8 @@ OpenCelliD Project is licensed under a Creative Commons Attribution-ShareAlike 4
<Tabs groupId="deployMethod"> <Tabs groupId="deployMethod">
<TabItem value="serverless" label="ClickHouse Cloud" default> <TabItem value="serverless" label="ClickHouse Cloud" default>
### Load the sample data
ClickHouse Cloud provides an easy-button for uploading this dataset from S3. Log in to your ClickHouse Cloud organization, or create a free trial at [ClickHouse.cloud](https://clickhouse.cloud). ClickHouse Cloud provides an easy-button for uploading this dataset from S3. Log in to your ClickHouse Cloud organization, or create a free trial at [ClickHouse.cloud](https://clickhouse.cloud).
<ActionsMenu menu="Load Data" /> <ActionsMenu menu="Load Data" />
@ -44,7 +44,7 @@ Choose the **Cell Towers** dataset from the **Sample data** tab, and **Load data
![Load cell towers dataset](@site/docs/en/_snippets/images/cloud-load-data-sample.png) ![Load cell towers dataset](@site/docs/en/_snippets/images/cloud-load-data-sample.png)
Examine the schema of the cell_towers table: ### Examine the schema of the cell_towers table
```sql ```sql
DESCRIBE TABLE cell_towers DESCRIBE TABLE cell_towers
``` ```
@ -120,7 +120,7 @@ clickhouse-client --query "INSERT INTO cell_towers FORMAT CSVWithNames" < cell_t
</TabItem> </TabItem>
</Tabs> </Tabs>
## Example queries {#examples} ## Run some example queries {#examples}
1. A number of cell towers by type: 1. A number of cell towers by type:
@ -260,7 +260,7 @@ WHERE pointInPolygon((lon, lat), (SELECT * FROM moscow))
## Review of the schema ## Review of the schema
This dataset primarily provides the location (Longitude and Latitude) and radio types at mobile cellular towers worldwide. The column descriptions can be found in the [community forum](https://community.opencellid.org/t/documenting-the-columns-in-the-downloadable-cells-database-csv/186). The columns used in the visualizations that will be built are described below Before building visualizations in Superset have a look at the columns that you will use. This dataset primarily provides the location (Longitude and Latitude) and radio types at mobile cellular towers worldwide. The column descriptions can be found in the [community forum](https://community.opencellid.org/t/documenting-the-columns-in-the-downloadable-cells-database-csv/186). The columns used in the visualizations that will be built are described below
Here is a description of the columns taken from the OpenCelliD forum: Here is a description of the columns taken from the OpenCelliD forum:
@ -288,20 +288,17 @@ Superset is easy to run from Docker. If you already have Superset running, all
<SupersetDocker /> <SupersetDocker />
### Build a dashboard
To build a Superset dashboard using the OpenCelliD dataset you should: To build a Superset dashboard using the OpenCelliD dataset you should:
- Add your ClickHouse service as a Superset **database** - Add your ClickHouse service as a Superset **database**
- Add the table **cell_towers** as a Superset **dataset** - Add the table **cell_towers** as a Superset **dataset**
- Create some **charts** - Create some **charts**
- Add the charts to a **dashboard** - Add the charts to a **dashboard**
1. Add your ClickHouse service as a Superset **database** ### Add your ClickHouse service as a Superset database
## 1. Gather your connection details
<ConnectionDetails /> <ConnectionDetails />
In Superset a database can be added by choosing the database type, and then providing the connection details. In Superset a database can be added by choosing the database type, and then providing the connection details. Open Superset and look for the **+**, it has a menu with **Data** and then **Connect database** options.
![Add a database](@site/docs/en/getting-started/example-datasets/images/superset-add.png) ![Add a database](@site/docs/en/getting-started/example-datasets/images/superset-add.png)
@ -309,9 +306,11 @@ To build a Superset dashboard using the OpenCelliD dataset you should:
![Choose clickhouse connect as database type](@site/docs/en/getting-started/example-datasets/images/superset-choose-a-database.png) ![Choose clickhouse connect as database type](@site/docs/en/getting-started/example-datasets/images/superset-choose-a-database.png)
#### Choose :::note
If **ClickHouse Connect** is not one of your options, then you will need to install it. The comand is `pip install clickhouse-connect`, and more info is [available here](https://pypi.org/project/clickhouse-connect/).
:::
Add your connection details: #### Add your connection details:
:::tip :::tip
Make sure that you set **SSL** on when connecting to ClickHouse Cloud or other ClickHouse systems that enforce the use of SSL. Make sure that you set **SSL** on when connecting to ClickHouse Cloud or other ClickHouse systems that enforce the use of SSL.
@ -319,19 +318,19 @@ Add your connection details:
![Add ClickHouse as a Superset datasource](@site/docs/en/getting-started/example-datasets/images/superset-connect-a-database.png) ![Add ClickHouse as a Superset datasource](@site/docs/en/getting-started/example-datasets/images/superset-connect-a-database.png)
1. Add the table **cell_towers** as a Superset **dataset** ### Add the table **cell_towers** as a Superset **dataset**
In Superset a **dataset** maps to a table within a database. Click on add a dataset and choose your ClickHouse service, the database containing your table (`default`), and choose the `cell_towers` table: In Superset a **dataset** maps to a table within a database. Click on add a dataset and choose your ClickHouse service, the database containing your table (`default`), and choose the `cell_towers` table:
![Add cell_towers table as a dataset](@site/docs/en/getting-started/example-datasets/images/superset-add-dataset.png) ![Add cell_towers table as a dataset](@site/docs/en/getting-started/example-datasets/images/superset-add-dataset.png)
1. Create a new **Chart** ### Create some **charts**
When you choose to add a chart in Superset you have to specify the dataset (`cell_towers`) and the chart type. Since the OpenCelliD dataset provides longitude and latitude coordinates for cell towers we will create a **Map** chart. The **deck.gL Scatterplot** type is suited to this dataset as it works well with dense data points on a map. When you choose to add a chart in Superset you have to specify the dataset (`cell_towers`) and the chart type. Since the OpenCelliD dataset provides longitude and latitude coordinates for cell towers we will create a **Map** chart. The **deck.gL Scatterplot** type is suited to this dataset as it works well with dense data points on a map.
![Create a map in Superset](@site/docs/en/getting-started/example-datasets/images/superset-create-map.png) ![Create a map in Superset](@site/docs/en/getting-started/example-datasets/images/superset-create-map.png)
1. Specify the query used for the map #### Specify the query used for the map
A deck.gl Scatterplot requires a longitude and latitude, and one or more filters can also be applied to the query. In this example two filters are applied, one for cell towers with UMTS radios, and one for the Mobile country code assigned to The Netherlands. A deck.gl Scatterplot requires a longitude and latitude, and one or more filters can also be applied to the query. In this example two filters are applied, one for cell towers with UMTS radios, and one for the Mobile country code assigned to The Netherlands.
@ -339,28 +338,30 @@ The fields `lon` and `lat` contain the longitude and latitude:
![Specify longitude and latitude fields](@site/docs/en/getting-started/example-datasets/images/superset-lon-lat.png) ![Specify longitude and latitude fields](@site/docs/en/getting-started/example-datasets/images/superset-lon-lat.png)
1. Add the charts to a **dashboard**
Add a filter with `mcc` = `204` (or substitute any other `mcc` value): Add a filter with `mcc` = `204` (or substitute any other `mcc` value):
![Filter on MCC 204](@site/docs/en/getting-started/example-datasets/images/superset-mcc-204.png) ![Filter on MCC 204](@site/docs/en/getting-started/example-datasets/images/superset-mcc-204.png)
1. foo
Add a filter with `radio` = `'UMTS'` (or substitute any other `radio` value, you can see the choices in the output of `DESCRIBE TABLE cell_towers`): Add a filter with `radio` = `'UMTS'` (or substitute any other `radio` value, you can see the choices in the output of `DESCRIBE TABLE cell_towers`):
![Filter on radio = UMTS](@site/docs/en/getting-started/example-datasets/images/superset-radio-umts.png) ![Filter on radio = UMTS](@site/docs/en/getting-started/example-datasets/images/superset-radio-umts.png)
This is the full comfiguration for the chart that filters on `radio = 'UMTS'` and `mcc = 204`: This is the full configuration for the chart that filters on `radio = 'UMTS'` and `mcc = 204`:
![Chart for UMTS radios in MCC 204](@site/docs/en/getting-started/example-datasets/images/superset-umts-netherlands.png) ![Chart for UMTS radios in MCC 204](@site/docs/en/getting-started/example-datasets/images/superset-umts-netherlands.png)
Click on **UPDATE CHART** to render the visualization. Click on **UPDATE CHART** to render the visualization.
1. This screenshot shows cell tower locations with LTE, UMTS, and GSM radios. The charts are all created in the same way and they are added to a dashboard. ### Add the charts to a **dashboard**
This screenshot shows cell tower locations with LTE, UMTS, and GSM radios. The charts are all created in the same way and they are added to a dashboard.
![Dashboard of cell towers by radio type in mcc 204](@site/docs/en/getting-started/example-datasets/images/superset-cell-tower-dashboard.png) ![Dashboard of cell towers by radio type in mcc 204](@site/docs/en/getting-started/example-datasets/images/superset-cell-tower-dashboard.png)
The data is also available for interactive queries in the [Playground](https://play.clickhouse.com/play?user=play), [example](https://play.clickhouse.com/play?user=play#U0VMRUNUIG1jYywgY291bnQoKSBGUk9NIGNlbGxfdG93ZXJzIEdST1VQIEJZIG1jYyBPUkRFUiBCWSBjb3VudCgpIERFU0M=). :::tip
The data is also available for interactive queries in the [Playground](https://play.clickhouse.com/play?user=play).
Although you cannot create tables there. This [example](https://play.clickhouse.com/play?user=play#U0VMRUNUIG1jYywgY291bnQoKSBGUk9NIGNlbGxfdG93ZXJzIEdST1VQIEJZIG1jYyBPUkRFUiBCWSBjb3VudCgpIERFU0M=) will populate the username and even the query for you.
Although you cannot create tables in the Playground, you can run all of the queries and even use Superset (adjust the hostname and port number).
:::