Skip to content

Commit 59c46be

Browse files
committed
docs: clarify streaming load column mapping
1 parent c71af34 commit 59c46be

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

docs/cn/guides/20-self-hosted/04-references/http-streaming-load.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ FILE_FORMAT=(type=<format> [<options>...])
5353
X-Databend-SQL: insert into demo.people(name,age,city) values (?, ?, 'BJ') from @_databend_load file_format=(type=csv skip_header=1)
5454
```
5555

56+
### 列映射规则
57+
58+
- **不写列清单,也不写 `VALUES`**:按表的列定义顺序写入(文件字段依次对应表列)。
59+
- **写了列清单,但不写 `VALUES`**:按列清单的顺序写入(文件字段依次对应列清单)。
60+
- **写了列清单且写 `VALUES`**
61+
- 每个目标列对应 `VALUES` 中的一个表达式。
62+
- `VALUES` 里的每个 `?` 会依次消费上传文件里的一个字段。
63+
- **未提供的列**
64+
- 如果该列有 `DEFAULT`,则使用默认值;
65+
- 否则写入 `NULL`(若列是 `NOT NULL` 则会失败)。
66+
5667
**cURL 模板:**
5768

5869
```shell

docs/en/guides/20-self-hosted/04-references/http-streaming-load.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ Example (load two columns from a CSV file and set a constant):
5353
X-Databend-SQL: insert into demo.people(name,age,city) values (?, ?, 'BJ') from @_databend_load file_format=(type=csv skip_header=1)
5454
```
5555

56+
### Column mapping rules
57+
58+
- **No column list, no `VALUES`**: file fields map to table columns by table definition order.
59+
- **With column list, no `VALUES`**: file fields map to the listed columns in order.
60+
- **With column list and `VALUES`**:
61+
- Each target column gets the corresponding expression in `VALUES`.
62+
- Each `?` consumes one field from the uploaded file, in order.
63+
- **Columns not provided**:
64+
- Use column `DEFAULT` value if defined.
65+
- Otherwise insert `NULL` (and fail if the column is `NOT NULL`).
66+
5667
**cURL template:**
5768

5869
```shell

0 commit comments

Comments
 (0)