ClickHouse / ClickHouse/clickhouse-rs

Automatically set `query_id`

Open
#329 0 comments 0 reactions 0 assignees View on GitHub
1.0 blocker client feature parity enhancement
Dominant language
Rust
Stars
559
Forks
172
Avg merge
1d 19h
Merged PRs (30d)
3

Description

### Use case
ClickHouse supports the `replace_running_query` feature: https://clickhouse.com/docs/operations/settings/settings#replace_running_query

`query_id` can be set manually via `with_option()`, but we should be setting this automatically.

### Describe the solution you'd like

* `Query::get_query_id()`
* If `query_id` is not previously set, generate and store a query ID to return it? E.g. using `OnceLock`?
* `Query::with_query_id()`
* Like other explicit setters, easier to discover and use than `with_option()`.

Questions:
- [ ] Should `Insert` and `Inserter` gain this as well?

### Describe the alternatives you've considered

### Additional context
1.0 wishlist: feature parity

Contributor guide

Open the contributing guide

Research direction

Start by locating Query's existing with_option implementation and any current query_id handling. Compare the proposed get_query_id and with_query_id behavior with the existing explicit setters, then determine whether Insert and Inserter should support the same API. Done means an unset query receives a stored generated ID, explicit IDs remain usable, and the chosen scope is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
clickhouse, rust
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.