Skip to content

Commit

Permalink
Merge pull request #1543 from ClickHouse/quicksight-connection
Browse files Browse the repository at this point in the history
Quicksight connection docs
  • Loading branch information
slvrtrn authored Sep 26, 2023
2 parents 571b431 + da5a89c commit c80465b
Show file tree
Hide file tree
Showing 19 changed files with 183 additions and 109 deletions.
11 changes: 11 additions & 0 deletions docs/en/_snippets/_clickhouse_mysql_cloud_setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1. After creating your ClickHouse Cloud Service, on the credentials screen, select the MySQL tab
![Credentials screen - Prompt](./images/mysql1.png)
2. Toggle the switch to enable the MySQL interface for this specific service. This will expose port `3306` for this service and prompt you with your MySQL connection screen that include your unique MySQL username. The password will be the same as the service's default user password.
![Credentials screen - Enabled MySQL](./images/mysql2.png)
Alternatively, in order to enable the MySQL interface for an existing service:
3. Ensure your service is in `Running` state then click on the "View connection string" button for the service you want to enable the MySQL interface for
![Connection screen - Prompt MySQL](./images/mysql3.png)
4. Toggle the switch to enable the MySQL interface for this specific service. This will prompt you to enter the default password.
![Connection screen - Prompt MySQL](./images/mysql4.png)
5. After entering the password, you will get prompted the MySQL connection string for this service
![Connection screen - MySQL Enabled](./images/mysql5.png)
87 changes: 87 additions & 0 deletions docs/en/_snippets/_clickhouse_mysql_on_premise_setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Please refer to [the official documentation](https://clickhouse.com/docs/en/interfaces/mysql)
on how to set up a ClickHouse server with enabled MySQL interface.

Aside from adding an entry to the server's `config.xml`

```xml
<clickhouse>
<mysql_port>9004</mysql_port>
</clickhouse>
```

it is also _required_ to use
[Double SHA1 password encryption](https://clickhouse.com/docs/en/operations/settings/settings-users#user-namepassword)
for the user that will be using MySQL interface.

Generating a random password encrypted with Double SHA1 from the shell:

```shell
PASSWORD=$(base64 < /dev/urandom | head -c16); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-'
```

The output should look like the following:

```
LZOQYnqQN4L/T6L0
fbc958cc745a82188a51f30de69eebfc67c40ee4
```

The first line is the generated password, and the second line is the hash we could use to configure ClickHouse.

Here is an example configuration for `mysql_user` that uses the generated hash:

`/etc/clickhouse-server/users.d/mysql_user.xml`

```xml
<users>
<mysql_user>
<password_double_sha1_hex>fbc958cc745a82188a51f30de69eebfc67c40ee4</password_double_sha1_hex>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</mysql_user>
</users>
```

Replace `password_double_sha1_hex` entry with your own generated Double SHA1 hash.

Additionally, it is recommended to use `use_mysql_types_in_show_columns`
to show the native MySQL types instead of ClickHouse ones in `SHOW [FULL] COLUMNS` query results,
which allows BI tools to properly introspect the database schema when using MySQL connectors.

For example:

`/etc/clickhouse-server/users.d/mysql_user.xml`

```xml
<profiles>
<default>
<use_mysql_types_in_show_columns>1</use_mysql_types_in_show_columns>
</default>
</profiles>
```

or assign it to a different profile instead of the default one.

If you have the `mysql` binary available, you can test the connection from the commandline.
Using the sample username (`mysql_user`) and password (`LZOQYnqQN4L/T6L0`) from above the command line would be:

```bash
mysql --protocol tcp -h localhost -u mysql_user -P 9004 --password=LZOQYnqQN4L/T6L0
```

```
mysql> show databases;
+--------------------+
| name |
+--------------------+
| INFORMATION_SCHEMA |
| default |
| information_schema |
| system |
+--------------------+
4 rows in set (0.00 sec)
Read 4 rows, 603.00 B in 0.00156 sec., 2564 rows/sec., 377.48 KiB/sec.
```
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
34 changes: 17 additions & 17 deletions docs/en/integrations/data-visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ Now that your data is in ClickHouse, it's time to analyze it, which often involv

## ClickHouse Cloud Compatibility with Data Visualization Tools

| Tool | Supported via | Tested |Documented| Comment |
|-----------------------------------------------------------------------|---------------------|--------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Apache Superset](./data-visualization/superset-and-clickhouse.md) | ClickHouse official connector ||| |
| AWS QuickSight | MySQL interface | | | Works with some limitations ([#53061](https://github.com/ClickHouse/ClickHouse/issues/53061), [#53066](https://github.com/ClickHouse/ClickHouse/issues/53066)) |
| [Deepnote](./data-visualization/deepnote.md) | Native connector | | | |
| [Explo](./data-visualization/explo-and-clickhouse.md) | Native connector | | | |
| [Grafana](./data-visualization/grafana-and-clickhouse.md) | ClickHouse official connector ||| |
| [Looker](./data-visualization/looker-and-clickhouse.md) | Native connector || | Works with some limitations, see [the documentation](./data-visualization/looker-and-clickhouse.md) for more details |
| Looker | MySQL interface | 🚧 | | |
| [Looker Studio](./data-visualization/looker-studio-and-clickhouse.md) | MySQL interface | | | |
| [Metabase](./data-visualization/metabase-and-clickhouse.md) | ClickHouse official connector ||| |
| [Power BI Desktop](./data-visualization/powerbi-and-clickhouse.md) | ClickHouse official connector ||| Via ODBC, not suitable for large workloads (no direct query mode) |
| Power BI service | ClickHouse official connector | 🚧 || |
| [Rocket BI](./data-visualization/rocketbi-and-clickhouse.md) | Native connector | | | |
| [Tableau Desktop](./data-visualization/tableau-and-clickhouse.md) | ClickHouse official connector ||| Certification in progress |
| Tableau Online | MySQL interface | 🚧 | | Compatibility fix in progress |
| [Zing Data](./data-visualization/zingdata-and-clickhouse.md) | Native connector | | | |
| Tool | Supported via | Tested | Documented | Comment |
|-----------------------------------------------------------------------|-------------------------------|--------|------------|--------------------------------------------------------------------------------------------------------------------------|
| [Apache Superset](./data-visualization/superset-and-clickhouse.md) | ClickHouse official connector | || |
| [AWS QuickSight](./data-visualization/quicksight-and-clickhouse.md) | MySQL interface | | | Works with some limitations, see [the documentation](./data-visualization/quicksight-and-clickhouse.md) for more details |
| [Deepnote](./data-visualization/deepnote.md) | Native connector | | | |
| [Explo](./data-visualization/explo-and-clickhouse.md) | Native connector | | | |
| [Grafana](./data-visualization/grafana-and-clickhouse.md) | ClickHouse official connector | || |
| [Looker](./data-visualization/looker-and-clickhouse.md) | Native connector | | | Works with some limitations, see [the documentation](./data-visualization/looker-and-clickhouse.md) for more details |
| Looker | MySQL interface | 🚧 | | |
| [Looker Studio](./data-visualization/looker-studio-and-clickhouse.md) | MySQL interface | | | |
| [Metabase](./data-visualization/metabase-and-clickhouse.md) | ClickHouse official connector | || |
| [Power BI Desktop](./data-visualization/powerbi-and-clickhouse.md) | ClickHouse official connector | | | Via ODBC, not suitable for large workloads (no direct query mode) |
| Power BI service | ClickHouse official connector | 🚧 || |
| [Rocket BI](./data-visualization/rocketbi-and-clickhouse.md) | Native connector | | | |
| [Tableau Desktop](./data-visualization/tableau-and-clickhouse.md) | ClickHouse official connector | | | Certification in progress |
| Tableau Online | MySQL interface | 🚧 | | Compatibility fix in progress |
| [Zing Data](./data-visualization/zingdata-and-clickhouse.md) | Native connector | | | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,105 +5,18 @@ keywords: [clickhouse, looker, studio, connect, integrate, ui]
description: Looker Studio, formerly Google Data Studio, is an online tool for converting data into customizable informative reports and dashboards.
---

import MySQLCloudSetup from '@site/docs/en/_snippets/_clickhouse_mysql_cloud_setup.mdx';
import MySQLOnPremiseSetup from '@site/docs/en/_snippets/_clickhouse_mysql_on_premise_setup.mdx';

# Looker Studio

Looker Studio can connect to ClickHouse via the MySQL interface using the official Google MySQL data source.

## ClickHouse Cloud Setup
1. After creating your ClickHouse Cloud Service, on the credentials screen, select the MySQL tab

![Credentials screen - Prompt](./images/mysql1.png)

2. Toggle the switch to enable the MySQL interface for this specific service. This will expose port `3306` for this service and prompt you with your MySQL connection screen that include your unique MySQL username. The password will be the same as the service's default user password.

![Credentials screen - Enabled MySQL](./images/mysql2.png)

Alternatively, in order to enable the MySQL interface for an exisitng service:

1. Ensure your service is in `Running` state then click on the "View connection string" button for the service you want to enable the MySQL interface for

![Connection screen - Prompt MySQL](./images/mysql3.png)

2. Toggle the switch to enable the MySQL interface for this specific service. This will prompt you to enter the default password.

![Connection screen - Prompt MySQL](./images/mysql4.png)

3. After entering the password, you will get prompted the MySQL connection string for this service
![Connection screen - MySQL Enabled](./images/mysql5.png)
<MySQLCloudSetup />

## On-premise ClickHouse Server Setup

Please refer to [the official documentation](https://clickhouse.com/docs/en/interfaces/mysql)
on how to set up a ClickHouse server with enabled MySQL interface.

Aside from adding an entry to the server's `config.xml`

```xml
<clickhouse>
<mysql_port>9004</mysql_port>
</clickhouse>
```

it is also _required_ to use
[Double SHA1 password encryption](https://clickhouse.com/docs/en/operations/settings/settings-users#user-namepassword)
for the user that will be using MySQL interface.

Generating a random password encrypted with Double SHA1 from the shell:

```shell
PASSWORD=$(base64 < /dev/urandom | head -c16); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-'
```

The output should look like the following:

```
LZOQYnqQN4L/T6L0
fbc958cc745a82188a51f30de69eebfc67c40ee4
```

The first line is the generated password, and the second line is the hash we could use to configure ClickHouse.

Here is an example configuration for `mysql_user` that uses the generated hash:

`/etc/clickhouse-server/users.d/mysql_user.xml`

```xml
<users>
<mysql_user>
<password_double_sha1_hex>fbc958cc745a82188a51f30de69eebfc67c40ee4</password_double_sha1_hex>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</mysql_user>
</users>
```

Replace `password_double_sha1_hex` entry with your own generated Double SHA1 hash.

Once the configuration is done, Looker Studio should be able to connect to ClickHouse via MySQL interface.

If you have the `mysql` binary available, you can test the connection from the commandline.
Using the sample username (`mysql_user`) and password (`LZOQYnqQN4L/T6L0`) from above the command line would be:

```bash
mysql --protocol tcp -h localhost -u mysql_user -P 9004 --password=LZOQYnqQN4L/T6L0
```

```
mysql> show databases;
+--------------------+
| name |
+--------------------+
| INFORMATION_SCHEMA |
| default |
| information_schema |
| system |
+--------------------+
4 rows in set (0.00 sec)
Read 4 rows, 603.00 B in 0.00156 sec., 2564 rows/sec., 377.48 KiB/sec.
```
<MySQLOnPremiseSetup />

## Connecting Looker Studio to ClickHouse

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
sidebar_label: QuickSight
slug: /en/integrations/quicksight
keywords: [clickhouse, aws, amazon, quicksight, connect, integrate, ui]
description: Amazon QuickSight powers data-driven organizations with unified business intelligence (BI) at hyperscale.
---

import MySQLCloudSetup from '@site/docs/en/_snippets/_clickhouse_mysql_cloud_setup.mdx';
import MySQLOnPremiseSetup from '@site/docs/en/_snippets/_clickhouse_mysql_on_premise_setup.mdx';

# QuickSight

QuickSight can connect to ClickHouse Cloud or on-premise ClickHouse setup via MySQL interface using the official MySQL data source.

## ClickHouse Cloud Setup
<MySQLCloudSetup />

## On-premise ClickHouse Server Setup
<MySQLOnPremiseSetup />

## Connecting QuickSight to ClickHouse

First of all, go to https://quicksight.aws.amazon.com, navigate to Datasets and click "New dataset":

<img src={require('./images/quicksight_01.png').default} class="image" alt="Creating a new dataset" style={{width: '75%', 'background-color': 'transparent'}}/>
<br/>

Search for the official MySQL connector bundled with QuickSight (named just **MySQL**):

<img src={require('./images/quicksight_02.png').default} class="image" alt="MySQL connector search" style={{width: '75%', 'background-color': 'transparent'}}/>
<br/>

Specify your connection details. Please note that MySQL interface port is 9004 by default,
and it might be different depending on your server configuration.

<img src={require('./images/quicksight_03.png').default} class="image" alt="Specifying the connection details" style={{width: '75%', 'background-color': 'transparent'}}/>
<br/>

Now, you have two options on how to fetch the data from ClickHouse. First, you could select a table from the list:

<img src={require('./images/quicksight_04.png').default} class="image" alt="Selecting a table from the list" style={{width: '75%', 'background-color': 'transparent'}}/>
<br/>

Alternatively, you could specify a custom SQL to fetch your data:

<img src={require('./images/quicksight_05.png').default} class="image" alt="Using custom SQL to fetch the data" style={{width: '75%', 'background-color': 'transparent'}}/>
<br/>

By clicking "Edit/Preview data", you should be able to see the introspected table structure or adjust your custom SQL, if that's how you decided to access the data:

<img src={require('./images/quicksight_06.png').default} class="image" alt="Viewing the introspected table structure" style={{width: '75%', 'background-color': 'transparent'}}/>
<br/>

Now you can proceed with publishing your dataset and creating a new visualization!

## Known limitations

- Median aggregation does not work. See [#53066](https://github.com/ClickHouse/ClickHouse/issues/53066) for more details.
- String types might not be recognized properly when `use_mysql_types_in_show_columns` setting is enabled. See [#52777](https://github.com/ClickHouse/ClickHouse/issues/52777) for more details.
Loading

0 comments on commit c80465b

Please sign in to comment.