Builds QueryInfo messages for ClickHouse gRPC requests.
Summary
Functions
Builds a QueryInfo struct for a SQL query.
Builds a cancel QueryInfo to stop a running query.
Builds a continuation QueryInfo for streaming input.
Builds an external table definition for use with queries.
Builds a QueryInfo struct for an INSERT query with input data.
Applies a pool's config to per-call query options.
Types
Functions
@spec build(String.t(), query_opts()) :: struct()
Builds a QueryInfo struct for a SQL query.
Options
:database- Database to use for the query:user_name- Username for authentication:password- Password for authentication:jwt- JWT token for authentication:format- Output format (default: "TabSeparated"):settings- Map of ClickHouse settings:query_id- Custom query ID for tracking:session_id- Session ID for stateful queries:session_timeout- Session timeout in seconds:send_output_columns- Include column metadata in response
@spec build_cancel() :: struct()
Builds a cancel QueryInfo to stop a running query.
Builds a continuation QueryInfo for streaming input.
Used with ExecuteQueryWithStreamInput and ExecuteQueryWithStreamIO methods.
@spec build_external_table( String.t(), [{String.t(), String.t()}], binary(), keyword() ) :: struct()
Builds an external table definition for use with queries.
Options
:format- Data format (default: "TabSeparated"):compression- Compression type of data:settings- Additional settings for the table
Builds a QueryInfo struct for an INSERT query with input data.
The input data format is taken from the SQL FORMAT clause (e.g.
INSERT INTO t FORMAT TabSeparated), not from an option.
Options
Same as build/2 (except :format and :send_output_columns, which do not
apply to inserts) plus:
:input_compression- Compression type ofdata(e.g."gzip"); the server decompresses it before parsing
@spec with_config(keyword(), Huginn.Clickhouse.Config.t()) :: keyword()
Applies a pool's config to per-call query options.
The config's :database and authentication credentials become defaults;
options given in opts always win.
Examples
iex> config = Huginn.Clickhouse.Config.new(host: "localhost", database: "analytics")
iex> Huginn.Clickhouse.Query.with_config([format: "JSON"], config)
[database: "analytics", format: "JSON"]