ClickHouseClient icon indicating copy to clipboard operation
ClickHouseClient copied to clipboard

Replace query parameters with their values

Open victor-sushko opened this issue 4 years ago • 0 comments

Currently parameters' values are passed along with the query as a table with the only one row. In the query each parameter is replaced with the SELECT subquery (see implementation details). However, there are some placed in the query where such subqueries are not allowed (#42, #46, #48).

Another way to pass parameters is implemented in the ClickHouse command-line client. This client substitutes parameters with their values. Similar behavior could be implemented in the ClickHouseClient as well.

In order to keep a backward compatibility the current behavior should remain the default behavior of ClickHouseClient. Which means that that the new behavior must be explicitly requested by the client code.

The strategy for passing parameters to the query can be defined at three levels:

  1. Parameter. Affects only this parameter;
  2. Command. Affects all command's parameters;
  3. Connection. Affects all parameters in all commands executed with this connection.

victor-sushko avatar Mar 22 '22 09:03 victor-sushko