Skip to content

Commit 69ee512

Browse files
sundy-lib41sh
andauthored
docs: add SHOW DICTIONARIES SQL reference (#3157)
* docs: add show dictionaries sql reference * fix --------- Co-authored-by: baishen <baishen2009@gmail.com>
1 parent 6108387 commit 69ee512

4 files changed

Lines changed: 139 additions & 0 deletions

File tree

docs/cn/sql-reference/10-sql-commands/00-ddl/17-dictionary/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Dictionary 提供了一种基于键值对的方法,用于从各种外部数据
1717
| 命令 | 描述 |
1818
|---------|-------------|
1919
| [SHOW CREATE DICTIONARY](show-create-dictionary.md) | 显示字典的 CREATE 语句 |
20+
| [SHOW DICTIONARIES](show-dictionaries.md) | 列出字典 |
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: SHOW DICTIONARIES
3+
sidebar_position: 5
4+
---
5+
6+
列出当前数据库或指定数据库中的字典。
7+
8+
## 语法
9+
10+
```sql
11+
SHOW DICTIONARIES [ FROM <database_name> | IN <database_name> ]
12+
[ LIMIT <limit> ]
13+
[ LIKE '<pattern>' | WHERE <expr> ]
14+
```
15+
16+
## 参数
17+
18+
| 参数 | 说明 |
19+
|-----------|-------------|
20+
| `FROM <database_name>` / `IN <database_name>` | 可选。列出指定数据库中的字典。 |
21+
| `LIMIT <limit>` | 可选。限制返回的行数。 |
22+
| `LIKE '<pattern>'` | 可选。按模式过滤字典名称。 |
23+
| `WHERE <expr>` | 可选。使用表达式过滤结果集。 |
24+
25+
## 示例
26+
27+
```sql
28+
CREATE DICTIONARY user_info
29+
(
30+
user_id UInt64,
31+
user_name String,
32+
user_email String
33+
)
34+
PRIMARY KEY user_id
35+
SOURCE(
36+
mysql(
37+
host = '127.0.0.1'
38+
port = '3306'
39+
username = 'root'
40+
password = 'root'
41+
db = 'app'
42+
table = 'users'
43+
)
44+
)
45+
COMMENT 'User dictionary from MySQL';
46+
47+
CREATE DICTIONARY cache
48+
(
49+
key String,
50+
value String
51+
)
52+
PRIMARY KEY key
53+
SOURCE(
54+
redis(
55+
host = '127.0.0.1'
56+
port = '6379'
57+
)
58+
)
59+
COMMENT 'cache dictionary from Redis';
60+
61+
SHOW DICTIONARIES;
62+
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
63+
│ database │ dictionary │ key_names │ key_types │ attribute_names │ attribute_types │ source │ comment │
64+
│ String │ String │ Array(String) │ Array(String) │ Array(String) │ Array(String) │ String │ String │
65+
├──────────┼────────────┼───────────────┼──────────────────────────┼────────────────────────────┼─────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────┤
66+
│ default │ cache │ ["key"] │ ["VARCHAR NULL"] │ ["value"] │ ["VARCHAR NULL"] │ redis(host=127.0.0.1 port=6379) │ cache dictionary from Redis │
67+
│ default │ user_info │ ["user_id"] │ ["BIGINT UNSIGNED NULL"] │ ["user_name","user_email"] │ ["VARCHAR NULL","VARCHAR NULL"] │ mysql(db=app host=127.0.0.1 password=[hidden] port=3306 table=users username=root) │ User dictionary from MySQL │
68+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯```
69+
```

docs/en/sql-reference/10-sql-commands/00-ddl/17-dictionary/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Dictionary provides a key-value approach for reading data from various external
1717
| Command | Description |
1818
|---------|-------------|
1919
| [SHOW CREATE DICTIONARY](show-create-dictionary.md) | Shows the CREATE statement for a dictionary |
20+
| [SHOW DICTIONARIES](show-dictionaries.md) | Lists dictionaries |
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: SHOW DICTIONARIES
3+
sidebar_position: 5
4+
---
5+
6+
Lists dictionaries in the current or specified database.
7+
8+
## Syntax
9+
10+
```sql
11+
SHOW DICTIONARIES [ FROM <database_name> | IN <database_name> ]
12+
[ LIMIT <limit> ]
13+
[ LIKE '<pattern>' | WHERE <expr> ]
14+
```
15+
16+
## Parameters
17+
18+
| Parameter | Description |
19+
|-----------|-------------|
20+
| `FROM <database_name>` / `IN <database_name>` | Optional. Lists dictionaries from the specified database. |
21+
| `LIMIT <limit>` | Optional. Limits the number of returned rows. |
22+
| `LIKE '<pattern>'` | Optional. Filters dictionary names by pattern. |
23+
| `WHERE <expr>` | Optional. Filters the result set with an expression. |
24+
25+
## Examples
26+
27+
```sql
28+
CREATE DICTIONARY user_info
29+
(
30+
user_id UInt64,
31+
user_name String,
32+
user_email String
33+
)
34+
PRIMARY KEY user_id
35+
SOURCE(
36+
mysql(
37+
host = '127.0.0.1'
38+
port = '3306'
39+
username = 'root'
40+
password = 'root'
41+
db = 'app'
42+
table = 'users'
43+
)
44+
)
45+
COMMENT 'User dictionary from MySQL';
46+
47+
CREATE DICTIONARY cache
48+
(
49+
key String,
50+
value String
51+
)
52+
PRIMARY KEY key
53+
SOURCE(
54+
redis(
55+
host = '127.0.0.1'
56+
port = '6379'
57+
)
58+
)
59+
COMMENT 'cache dictionary from Redis';
60+
61+
SHOW DICTIONARIES;
62+
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
63+
│ database │ dictionary │ key_names │ key_types │ attribute_names │ attribute_types │ source │ comment │
64+
│ String │ String │ Array(String) │ Array(String) │ Array(String) │ Array(String) │ String │ String │
65+
├──────────┼────────────┼───────────────┼──────────────────────────┼────────────────────────────┼─────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────┤
66+
│ default │ cache │ ["key"] │ ["VARCHAR NULL"] │ ["value"] │ ["VARCHAR NULL"] │ redis(host=127.0.0.1 port=6379) │ cache dictionary from Redis │
67+
│ default │ user_info │ ["user_id"] │ ["BIGINT UNSIGNED NULL"] │ ["user_name","user_email"] │ ["VARCHAR NULL","VARCHAR NULL"] │ mysql(db=app host=127.0.0.1 password=[hidden] port=3306 table=users username=root) │ User dictionary from MySQL │
68+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯```

0 commit comments

Comments
 (0)