v.23.9Improvement
clickhouse-local and clickhouse-client Enhance --query Parameter Support
clickhouse-localandclickhouse-clientnow allow to specify the--queryparameter multiple times, e.g../clickhouse-client --query "SELECT 1" --query "SELECT 2". This syntax is slightly more intuitive than./clickhouse-client --multiquery "SELECT 1;S ELECT 2", a bit easier to script (e.g.queries.push_back('--query "$q"')) and more consistent with the behavior of existing parameter--queries-file(e.g../clickhouse client --queries-file queries1.sql --queries-file queries2.sql). #54249 (Robert Schulze).
Why it matters
This feature addresses the need for a more intuitive and script-friendly way to run multiple queries sequentially, improving upon the previous--multiquery option which combined queries into a single string. It also aligns command behavior with the existing --queries-file parameter, making scripting and automation simpler and more consistent.How to use it
Users can run multiple queries by repeating the--query flag with different SQL statements, for example:./clickhouse-client --query "SELECT 1" --query "SELECT 2"This can also be used similarly in scripts by appending query strings individually with
--query parameters.