mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Update "Queries with Parameter" docs (#40317)
* impl * Update docs/en/interfaces/cli.md Co-authored-by: Yakov Olkhovskiy <99031427+yakov-olkhovskiy@users.noreply.github.com> Co-authored-by: Yakov Olkhovskiy <99031427+yakov-olkhovskiy@users.noreply.github.com>
This commit is contained in:
parent
07c5184b6e
commit
ce89660432
@ -82,6 +82,13 @@ You can create a query with parameters and pass values to them from client appli
|
||||
$ clickhouse-client --param_parName="[1, 2]" -q "SELECT * FROM table WHERE a = {parName:Array(UInt16)}"
|
||||
```
|
||||
|
||||
It is also possible to set parameters from within an interactive session:
|
||||
``` bash
|
||||
$ clickhouse-client -nq "
|
||||
SET param_parName='[1, 2]';
|
||||
SELECT {parName:Array(UInt16)}"
|
||||
```
|
||||
|
||||
#### Query Syntax {#cli-queries-with-parameters-syntax}
|
||||
|
||||
Format a query as usual, then place the values that you want to pass from the app parameters to the query in braces in the following format:
|
||||
|
@ -84,6 +84,13 @@ $ cat file.csv | clickhouse-client --database=test --query="INSERT INTO test FOR
|
||||
clickhouse-client --param_parName="[1, 2]" -q "SELECT * FROM table WHERE a = {parName:Array(UInt16)}"
|
||||
```
|
||||
|
||||
Также возможно устанавливать значения параметров, находясь внутри интерактивной сессии:
|
||||
``` bash
|
||||
$ clickhouse-client -nq "
|
||||
SET param_parName='[1, 2]';
|
||||
SELECT {parName:Array(UInt16)}"
|
||||
```
|
||||
|
||||
#### Синтаксис запроса {#cli-queries-with-parameters-syntax}
|
||||
|
||||
Отформатируйте запрос обычным способом. Представьте значения, которые вы хотите передать из параметров приложения в запрос в следующем формате:
|
||||
|
Loading…
Reference in New Issue
Block a user