mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
cd14f9ebcb
* split up select.md * array-join.md basic refactoring * distinct.md basic refactoring * format.md basic refactoring * from.md basic refactoring * group-by.md basic refactoring * having.md basic refactoring * additional index.md refactoring * into-outfile.md basic refactoring * join.md basic refactoring * limit.md basic refactoring * limit-by.md basic refactoring * order-by.md basic refactoring * prewhere.md basic refactoring * adjust operators/index.md links * adjust sample.md links * adjust more links * adjust operatots links * fix some links * adjust aggregate function article titles * basic refactor of remaining select clauses * absolute paths in make_links.sh * run make_links.sh * remove old select.md locations * translate docs/es * translate docs/fr * translate docs/fa * remove old operators.md location * change operators.md links * adjust links in docs/es * adjust links in docs/es * minor texts adjustments * wip * update machine translations to use new links * fix changelog * es build fixes * get rid of some select.md links * temporary adjust ru links * temporary adjust more ru links * improve curly brace handling * adjust ru as well * fa build fix * ru link fixes * zh link fixes * temporary disable part of anchor checks
1.8 KiB
1.8 KiB
machine_translated | machine_translated_rev | toc_priority | toc_title |
---|---|---|---|
true | 72537a2d52 |
46 | 输入 |
输入
input(structure)
-表功能,允许有效地转换和插入数据发送到
服务器与给定结构的表与另一种结构。
structure
-以下格式发送到服务器的数据结构 'column1_name column1_type, column2_name column2_type, ...'
.
例如, 'id UInt32, name String'
.
此功能只能用于 INSERT SELECT
查询,只有一次,但其他行为像普通表函数
(例如,它可以用于子查询等。).
数据可以以任何方式像普通发送 INSERT
查询并传递任何可用 格式
必须在查询结束时指定(不像普通 INSERT SELECT
).
这个功能的主要特点是,当服务器从客户端接收数据时,它同时将其转换
根据表达式中的列表 SELECT
子句并插入到目标表中。 临时表
不创建所有传输的数据。
例
- 让
test
表具有以下结构(a String, b String)
和数据data.csv
具有不同的结构(col1 String, col2 Date, col3 Int32)
. 查询插入 从数据data.csv
进test
同时转换的表如下所示:
$ cat data.csv | clickhouse-client --query="INSERT INTO test SELECT lower(col1), col3 * col3 FROM input('col1 String, col2 Date, col3 Int32') FORMAT CSV";
- 如果
data.csv
包含相同结构的数据test_structure
作为表test
那么这两个查询是相等的:
$ cat data.csv | clickhouse-client --query="INSERT INTO test FORMAT CSV"
$ cat data.csv | clickhouse-client --query="INSERT INTO test SELECT * FROM input('test_structure') FORMAT CSV"