Skip to content

Commit 79e22cd

Browse files
authored
docs: fix OpenDAL presign RFC link (#3035)
* docs: fix OpenDAL presign RFC link * docs: document streaming load column list
1 parent b791cc8 commit 79e22cd

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

docs/cn/developer/20-community/02-rfcs/20220704-presign.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ MySQL [(none)]> PRESIGN UPLOAD @my_stage/books.csv
7171

7272
`PRESIGN` 将作为语句而不是函数来实现,以便我们可以同时返回 HTTP 方法、headers 和 URL。
7373

74-
大多数工作已通过 Apache OpenDAL presign 完成。
74+
大多数工作已通过 [Apache OpenDAL presign](https://opendal.apache.org/docs/rust/opendal_core/docs/rfcs/rfc_0413_presign/index.html) 完成。
7575

7676
语法将是:
7777

@@ -182,4 +182,4 @@ PRESIGN 's3://bucket/books.csv'
182182

183183
```sql
184184
PRESIGN UPLOAD_PART 's3://bucket/books.csv.zst'
185-
```
185+
```

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,27 @@ HTTP Streaming Load 是一个专门用来“边传边导入”的接口:服务
3232
**SQL 结构(必需):**
3333

3434
```sql
35-
INSERT INTO <db>.<table>
35+
INSERT INTO <db>.<table>[(<col1>, <col2>, ...)]
36+
[(VALUES (<expr_or_?>, ...))]
3637
FROM @_databend_load
3738
FILE_FORMAT=(type=<format> [<options>...])
3839
```
3940

41+
### 指定目标列与 `VALUES`
42+
43+
你可以:
44+
45+
- 指定写入的目标列:`INSERT INTO t(col1, col2, ...) ...`
46+
-`FROM` 前写 `VALUES (...)`
47+
-`?` 表示从上传文件中读取的字段(按顺序对应)。
48+
- `?` 可以与常量混用。
49+
50+
示例(从 CSV 读取两列,并补一个常量列):
51+
52+
```text
53+
X-Databend-SQL: insert into demo.people(name,age,city) values (?, ?, 'BJ') from @_databend_load file_format=(type=csv skip_header=1)
54+
```
55+
4056
**cURL 模板:**
4157

4258
```shell
@@ -144,7 +160,7 @@ EOF
144160

145161
```shell
146162
curl -sS -u databend:databend \
147-
-H "X-Databend-SQL: insert into demo.people from @_databend_load file_format=(type=csv field_delimiter=',' skip_header=1)" \
163+
-H "X-Databend-SQL: insert into demo.people(id,name,age) from @_databend_load file_format=(type=csv field_delimiter=',' skip_header=1)" \
148164
-F "upload=@./people.csv" \
149165
-X PUT "http://localhost:8000/v1/streaming_load"
150166
```

docs/en/developer/20-community/02-rfcs/20220704-presign.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ MySQL [(none)]> PRESIGN UPLOAD @my_stage/books.csv
7171

7272
`PRESIGN` will be implemented as a statement instead of a function so that we can return the HTTP method, headers, and URL at the same time.
7373

74-
Most jobs have been done via Apache OpenDAL presign.
74+
Most jobs have been done via [Apache OpenDAL presign](https://opendal.apache.org/docs/rust/opendal_core/docs/rfcs/rfc_0413_presign/index.html).
7575

7676
The syntax will be:
7777

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,27 @@ It is useful when you:
3232
**SQL format (required):**
3333

3434
```sql
35-
INSERT INTO <db>.<table>
35+
INSERT INTO <db>.<table>[(<col1>, <col2>, ...)]
36+
[(VALUES (<expr_or_?>, ...))]
3637
FROM @_databend_load
3738
FILE_FORMAT=(type=<format> [<options>...])
3839
```
3940

41+
### Specifying columns and using `VALUES`
42+
43+
You can:
44+
45+
- Specify the target columns: `INSERT INTO t(col1, col2, ...) ...`
46+
- Provide `VALUES (...)` before `FROM`:
47+
- Use `?` as placeholders for fields read from the uploaded file (in order).
48+
- Mix `?` with constants.
49+
50+
Example (load two columns from a CSV file and set a constant):
51+
52+
```text
53+
X-Databend-SQL: insert into demo.people(name,age,city) values (?, ?, 'BJ') from @_databend_load file_format=(type=csv skip_header=1)
54+
```
55+
4056
**cURL template:**
4157

4258
```shell
@@ -155,7 +171,7 @@ Send a `PUT /v1/streaming_load` request:
155171

156172
```shell
157173
curl -sS -u databend:databend \
158-
-H "X-Databend-SQL: insert into demo.people from @_databend_load file_format=(type=csv field_delimiter=',' skip_header=1)" \
174+
-H "X-Databend-SQL: insert into demo.people(id,name,age) from @_databend_load file_format=(type=csv field_delimiter=',' skip_header=1)" \
159175
-F "upload=@./people.csv" \
160176
-X PUT "http://localhost:8000/v1/streaming_load"
161177
```

0 commit comments

Comments
 (0)