Skip to content

Commit c2da196

Browse files
CopilotWenyXu
andauthored
docs: add greptime cli meta put key and put table command documentation (#2456)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: WenyXu <32535939+WenyXu@users.noreply.github.com>
1 parent c887b56 commit c2da196

4 files changed

Lines changed: 352 additions & 4 deletions

File tree

docs/reference/command-lines/utilities/metadata-interaction.md

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
keywords: [GreptimeDB CLI, metadata interaction, key-value operations, table metadata, store backends]
3-
description: Guide for interacting with GreptimeDB metadata using the CLI, including key-value, table metadata retrieval, and deletion.
3+
description: Guide for interacting with GreptimeDB metadata using the CLI, including key-value, table metadata retrieval, insertion, and deletion.
44
---
55

66
# Metadata Interaction
@@ -53,6 +53,63 @@ greptime cli meta get table [OPTIONS]
5353
| `--pretty` | Pretty print the output | - |
5454

5555

56+
## Put key-value pair
57+
58+
### Command syntax
59+
60+
```bash
61+
greptime cli meta put key [OPTIONS] [KEY]
62+
```
63+
64+
### Options
65+
66+
| Option | Description | Default |
67+
| --------------- | ---------------------------------------- | ------- |
68+
| `--value-stdin` | Read the value from standard input | - |
69+
| `--no-validate` | Skip metadata validation before writing | false |
70+
71+
:::note
72+
`--value-stdin` is required.
73+
:::
74+
75+
## Put table metadata
76+
77+
### Put table info
78+
79+
#### Command syntax
80+
81+
```bash
82+
greptime cli meta put table info [OPTIONS]
83+
```
84+
85+
#### Options
86+
87+
| Option | Description | Default |
88+
| ------------------------------- | ---------------------------------------------------------------------- | -------- |
89+
| `--table-id <TABLE_ID>` | Select table by table id | - |
90+
| `--table-name <TABLE_NAME>` | Select table by table name | - |
91+
| `--schema-name <SCHEMA_NAME>` | The schema name of the table | public |
92+
| `--catalog-name <CATALOG_NAME>` | The catalog name of the table | greptime |
93+
| `--value-stdin` | Read the JSON-encoded `TableInfoValue` from standard input (required) | - |
94+
95+
### Put table route
96+
97+
#### Command syntax
98+
99+
```bash
100+
greptime cli meta put table route [OPTIONS]
101+
```
102+
103+
#### Options
104+
105+
| Option | Description | Default |
106+
| ------------------------------- | ----------------------------------------------------------------------- | -------- |
107+
| `--table-id <TABLE_ID>` | Select table by table id | - |
108+
| `--table-name <TABLE_NAME>` | Select table by table name | - |
109+
| `--schema-name <SCHEMA_NAME>` | The schema name of the table | public |
110+
| `--catalog-name <CATALOG_NAME>` | The catalog name of the table | greptime |
111+
| `--value-stdin` | Read the JSON-encoded `TableRouteValue` from standard input (required) | - |
112+
56113
## Delete key-value pair
57114

58115
### Command syntax
@@ -215,6 +272,36 @@ greptime cli meta get table --table-name=metric_table_2 \
215272

216273
Output: same as the output of the command above.
217274

275+
### Put table info
276+
277+
```bash
278+
cat table_info.json | greptime cli meta put table info \
279+
--table-id=1059 \
280+
--store-addrs=$ENDPOINT \
281+
--backend=postgres-store \
282+
--value-stdin
283+
```
284+
285+
Output:
286+
```bash
287+
Table(1059) info updated
288+
```
289+
290+
### Put table route
291+
292+
```bash
293+
cat table_route.json | greptime cli meta put table route \
294+
--table-id=1059 \
295+
--store-addrs=$ENDPOINT \
296+
--backend=postgres-store \
297+
--value-stdin
298+
```
299+
300+
Output:
301+
```bash
302+
Table(1059) route updated
303+
```
304+
218305
## Delete non-existent key-value pair
219306

220307
```bash

i18n/zh/docusaurus-plugin-content-docs/current/reference/command-lines/utilities/metadata-interaction.md

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
keywords: [GreptimeDB CLI, 元数据交互, 键值操作, 表元数据, 存储后端]
3-
description: 使用 CLI 与 GreptimeDB 元数据交互的指南,包括键值操作、表元数据检索和删除
3+
description: 使用 CLI 与 GreptimeDB 元数据交互的指南,包括键值操作、表元数据检索、写入和删除
44
---
55

66
# 元数据交互
@@ -54,6 +54,63 @@ greptime cli meta get table [OPTIONS]
5454
| `--pretty` | 美化输出 | - |
5555

5656

57+
## 写入键值对
58+
59+
### 命令语法
60+
61+
```bash
62+
greptime cli meta put key [OPTIONS] [KEY]
63+
```
64+
65+
### 选项
66+
67+
| 选项 | 描述 | 默认值 |
68+
| --------------- | ------------------------------------ | ------ |
69+
| `--value-stdin` | 从标准输入读取要写入的值 | - |
70+
| `--no-validate` | 写入前跳过元数据校验 | false |
71+
72+
:::note
73+
`--value-stdin` 为必填项。
74+
:::
75+
76+
## 写入表元数据
77+
78+
### 写入表信息
79+
80+
#### 命令语法
81+
82+
```bash
83+
greptime cli meta put table info [OPTIONS]
84+
```
85+
86+
#### 选项
87+
88+
| 选项 | 描述 | 默认值 |
89+
| ------------------------------- | ----------------------------------------------------- | -------- |
90+
| `--table-id <TABLE_ID>` | 通过表 ID 选择表 | - |
91+
| `--table-name <TABLE_NAME>` | 通过表名选择表 | - |
92+
| `--schema-name <SCHEMA_NAME>` | 所属数据库的名称 | public |
93+
| `--catalog-name <CATALOG_NAME>` | 所属 catalog 的名称 | greptime |
94+
| `--value-stdin` | 从标准输入读取 JSON 编码的 `TableInfoValue`(必填) | - |
95+
96+
### 写入表路由
97+
98+
#### 命令语法
99+
100+
```bash
101+
greptime cli meta put table route [OPTIONS]
102+
```
103+
104+
#### 选项
105+
106+
| 选项 | 描述 | 默认值 |
107+
| ------------------------------- | ------------------------------------------------------ | -------- |
108+
| `--table-id <TABLE_ID>` | 通过表 ID 选择表 | - |
109+
| `--table-name <TABLE_NAME>` | 通过表名选择表 | - |
110+
| `--schema-name <SCHEMA_NAME>` | 所属数据库的名称 | public |
111+
| `--catalog-name <CATALOG_NAME>` | 所属 catalog 的名称 | greptime |
112+
| `--value-stdin` | 从标准输入读取 JSON 编码的 `TableRouteValue`(必填) | - |
113+
57114
## 删除键值对
58115

59116
### 命令语法
@@ -215,6 +272,36 @@ greptime cli meta get table --table-name=metric_table_2 \
215272

216273
输出: 与上述命令的输出相同。
217274

275+
### 写入表信息
276+
277+
```bash
278+
cat table_info.json | greptime cli meta put table info \
279+
--table-id=1059 \
280+
--store-addrs=$ENDPOINT \
281+
--backend=postgres-store \
282+
--value-stdin
283+
```
284+
285+
输出:
286+
```bash
287+
Table(1059) info updated
288+
```
289+
290+
### 写入表路由
291+
292+
```bash
293+
cat table_route.json | greptime cli meta put table route \
294+
--table-id=1059 \
295+
--store-addrs=$ENDPOINT \
296+
--backend=postgres-store \
297+
--value-stdin
298+
```
299+
300+
输出:
301+
```bash
302+
Table(1059) route updated
303+
```
304+
218305
## 删除不存在的键值对
219306

220307
```bash

i18n/zh/docusaurus-plugin-content-docs/version-1.0/reference/command-lines/utilities/metadata-interaction.md

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
keywords: [GreptimeDB CLI, 元数据交互, 键值操作, 表元数据, 存储后端]
3-
description: 使用 CLI 与 GreptimeDB 元数据交互的指南,包括键值操作、表元数据检索和删除
3+
description: 使用 CLI 与 GreptimeDB 元数据交互的指南,包括键值操作、表元数据检索、写入和删除
44
---
55

66
# 元数据交互
@@ -54,6 +54,63 @@ greptime cli meta get table [OPTIONS]
5454
| `--pretty` | 美化输出 | - |
5555

5656

57+
## 写入键值对
58+
59+
### 命令语法
60+
61+
```bash
62+
greptime cli meta put key [OPTIONS] [KEY]
63+
```
64+
65+
### 选项
66+
67+
| 选项 | 描述 | 默认值 |
68+
| --------------- | ------------------------------------ | ------ |
69+
| `--value-stdin` | 从标准输入读取要写入的值 | - |
70+
| `--no-validate` | 写入前跳过元数据校验 | false |
71+
72+
:::note
73+
`--value-stdin` 为必填项。
74+
:::
75+
76+
## 写入表元数据
77+
78+
### 写入表信息
79+
80+
#### 命令语法
81+
82+
```bash
83+
greptime cli meta put table info [OPTIONS]
84+
```
85+
86+
#### 选项
87+
88+
| 选项 | 描述 | 默认值 |
89+
| ------------------------------- | ----------------------------------------------------- | -------- |
90+
| `--table-id <TABLE_ID>` | 通过表 ID 选择表 | - |
91+
| `--table-name <TABLE_NAME>` | 通过表名选择表 | - |
92+
| `--schema-name <SCHEMA_NAME>` | 所属数据库的名称 | public |
93+
| `--catalog-name <CATALOG_NAME>` | 所属 catalog 的名称 | greptime |
94+
| `--value-stdin` | 从标准输入读取 JSON 编码的 `TableInfoValue`(必填) | - |
95+
96+
### 写入表路由
97+
98+
#### 命令语法
99+
100+
```bash
101+
greptime cli meta put table route [OPTIONS]
102+
```
103+
104+
#### 选项
105+
106+
| 选项 | 描述 | 默认值 |
107+
| ------------------------------- | ------------------------------------------------------ | -------- |
108+
| `--table-id <TABLE_ID>` | 通过表 ID 选择表 | - |
109+
| `--table-name <TABLE_NAME>` | 通过表名选择表 | - |
110+
| `--schema-name <SCHEMA_NAME>` | 所属数据库的名称 | public |
111+
| `--catalog-name <CATALOG_NAME>` | 所属 catalog 的名称 | greptime |
112+
| `--value-stdin` | 从标准输入读取 JSON 编码的 `TableRouteValue`(必填) | - |
113+
57114
## 删除键值对
58115

59116
### 命令语法
@@ -215,6 +272,36 @@ greptime cli meta get table --table-name=metric_table_2 \
215272

216273
输出: 与上述命令的输出相同。
217274

275+
### 写入表信息
276+
277+
```bash
278+
cat table_info.json | greptime cli meta put table info \
279+
--table-id=1059 \
280+
--store-addrs=$ENDPOINT \
281+
--backend=postgres-store \
282+
--value-stdin
283+
```
284+
285+
输出:
286+
```bash
287+
Table(1059) info updated
288+
```
289+
290+
### 写入表路由
291+
292+
```bash
293+
cat table_route.json | greptime cli meta put table route \
294+
--table-id=1059 \
295+
--store-addrs=$ENDPOINT \
296+
--backend=postgres-store \
297+
--value-stdin
298+
```
299+
300+
输出:
301+
```bash
302+
Table(1059) route updated
303+
```
304+
218305
## 删除不存在的键值对
219306

220307
```bash

0 commit comments

Comments
 (0)