You need to enable JavaScript to run this app.
ByteHouse Enterprise Edition

ByteHouse Enterprise Edition

Copy page
Download PDF
Table function
input
Copy page
Download PDF
input

input(structure) - A table function that can efficiently convert data sent to the server into data with a given structure and insert it into a table with other structures.
structure - The format of the data structure sent to the server 'column1_name column1_type, column2_name column2_type, ...'. For example, 'id UInt32, name String'.
This function can only be used in INSERT SELECT queries, and only once, but otherwise behaves like a normal table function (for example, it can be used for subqueries, etc. ).
Data can be sent like a normal INSERT query, and passed in any available format that must be specified at the end of the query (unlike a normal INSERT SELECT).
The main feature of this function is that when the server receives data from the client, it simultaneously converts it according to the list of expressions in the SELECT clause and inserts it into the destination table. A temporary table containing all the transmitted data will not be created.
Example

$ cat data.csv | clickhouse-client --query="INSERT INTO test SELECT lower(col1), col3 * col3 FROM input('col1 String, col2 Date, col3 Int32') FORMAT CSV";
$ 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"
Last updated: 2026.03.31 16:09:08