From 28703ccead04e201b2ca6dd4ae3f64472e648de4 Mon Sep 17 00:00:00 2001 From: Justin de Guzman Date: Tue, 20 Jun 2023 09:00:03 -0700 Subject: [PATCH 1/5] Specify that user/password is required for dicts in SQL Console --- .../statements/create/dictionary.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/en/sql-reference/statements/create/dictionary.md b/docs/en/sql-reference/statements/create/dictionary.md index 29c72d62f24..19087384876 100644 --- a/docs/en/sql-reference/statements/create/dictionary.md +++ b/docs/en/sql-reference/statements/create/dictionary.md @@ -82,6 +82,28 @@ LIFETIME(MIN 0 MAX 1000) LAYOUT(FLAT()) ``` +:::note +When using the SQL console in [ClickHouse Cloud](https://clickhouse.com), you must specify a user (`default` or any other user) and password when creating a dictionary. +:::note + +```sql +CREATE TABLE foo_db.source_table ( + id UInt64, + value String +) ENGINE = MergeTree +PRIMARY KEY id; + +CREATE DICTIONARY foo_db.id_value_dictionary +( + id UInt64, + value String +) +PRIMARY KEY id +SOURCE(CLICKHOUSE(TABLE 'source_table' USER 'foo_user' PASSWORD 'foo_user_complex_password' DB 'foo_db' )) +LAYOUT(FLAT()) +LIFETIME(MIN 0 MAX 1000); +``` + ### Create a dictionary from a table in a remote ClickHouse service Input table (in the remote ClickHouse service) `source_table`: From 82e770bf9a63230936bfb328f4dbd083e32ce2b2 Mon Sep 17 00:00:00 2001 From: Justin de Guzman Date: Tue, 20 Jun 2023 09:48:40 -0700 Subject: [PATCH 2/5] SQL Console must use users with default role for dicts Co-authored-by: Dan Roscigno --- docs/en/sql-reference/statements/create/dictionary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/sql-reference/statements/create/dictionary.md b/docs/en/sql-reference/statements/create/dictionary.md index 19087384876..092d51a64f7 100644 --- a/docs/en/sql-reference/statements/create/dictionary.md +++ b/docs/en/sql-reference/statements/create/dictionary.md @@ -83,7 +83,7 @@ LAYOUT(FLAT()) ``` :::note -When using the SQL console in [ClickHouse Cloud](https://clickhouse.com), you must specify a user (`default` or any other user) and password when creating a dictionary. +When using the SQL console in [ClickHouse Cloud](https://clickhouse.com), you must specify a user (`default` or any other user with the role `default_role`) and password when creating a dictionary. :::note ```sql From 2718dab7faa747983b2bd71c321caefe23a36e45 Mon Sep 17 00:00:00 2001 From: Justin de Guzman Date: Tue, 20 Jun 2023 09:49:48 -0700 Subject: [PATCH 3/5] Specify database when creating dicts in docs Co-authored-by: Dan Roscigno --- docs/en/sql-reference/statements/create/dictionary.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/sql-reference/statements/create/dictionary.md b/docs/en/sql-reference/statements/create/dictionary.md index 092d51a64f7..9cc56dc1b85 100644 --- a/docs/en/sql-reference/statements/create/dictionary.md +++ b/docs/en/sql-reference/statements/create/dictionary.md @@ -87,6 +87,8 @@ When using the SQL console in [ClickHouse Cloud](https://clickhouse.com), you mu :::note ```sql +CREATE DATABASE foo_db; + CREATE TABLE foo_db.source_table ( id UInt64, value String From 62044d30794528d7608b163bc7cbd7656e5fa518 Mon Sep 17 00:00:00 2001 From: Justin de Guzman Date: Tue, 20 Jun 2023 09:50:49 -0700 Subject: [PATCH 4/5] Add info on creating users when creating dicts in SQL Console Co-authored-by: Dan Roscigno --- docs/en/sql-reference/statements/create/dictionary.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/en/sql-reference/statements/create/dictionary.md b/docs/en/sql-reference/statements/create/dictionary.md index 9cc56dc1b85..d4a3b54f130 100644 --- a/docs/en/sql-reference/statements/create/dictionary.md +++ b/docs/en/sql-reference/statements/create/dictionary.md @@ -87,6 +87,11 @@ When using the SQL console in [ClickHouse Cloud](https://clickhouse.com), you mu :::note ```sql +CREATE USER IF NOT EXISTS clickhouse_admin +IDENTIFIED WITH sha256_password BY 'passworD43$x'; + +GRANT default_role TO clickhouse_admin; + CREATE DATABASE foo_db; CREATE TABLE foo_db.source_table ( From af4159e71eabf9b21413cfcd0f37142e3b84fd9a Mon Sep 17 00:00:00 2001 From: Justin de Guzman Date: Tue, 20 Jun 2023 09:51:11 -0700 Subject: [PATCH 5/5] Use better user/pw examples for docs when creating dicts in SQL Console Co-authored-by: Dan Roscigno --- docs/en/sql-reference/statements/create/dictionary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/sql-reference/statements/create/dictionary.md b/docs/en/sql-reference/statements/create/dictionary.md index d4a3b54f130..c0a153c5660 100644 --- a/docs/en/sql-reference/statements/create/dictionary.md +++ b/docs/en/sql-reference/statements/create/dictionary.md @@ -106,7 +106,7 @@ CREATE DICTIONARY foo_db.id_value_dictionary value String ) PRIMARY KEY id -SOURCE(CLICKHOUSE(TABLE 'source_table' USER 'foo_user' PASSWORD 'foo_user_complex_password' DB 'foo_db' )) +SOURCE(CLICKHOUSE(TABLE 'source_table' USER 'clickhouse_admin' PASSWORD 'passworD43$x' DB 'foo_db' )) LAYOUT(FLAT()) LIFETIME(MIN 0 MAX 1000); ```