Generate query id on client side if not set#116
Merged
alex-clickhouse merged 2 commits intomainfrom Dec 8, 2025
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes the query ID generation from server-side to client-side by automatically generating a GUID when no query ID is explicitly set. Previously, ClickHouse server would generate the query ID; now the driver generates it before sending the request.
Key changes:
- Client-side GUID generation for query IDs when not explicitly provided
- Caching mechanism to ensure consistent query ID per request
- Updated documentation and examples to reflect the new behavior
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
examples/Advanced_001_QueryIdUsage.cs |
Updated comments to reflect client-side GUID generation instead of server-side |
ClickHouse.Driver/ClickHouseUriBuilder.cs |
Added GetEffectiveQueryId() method with caching logic and auto-GUID generation |
ClickHouse.Driver/ADO/ClickHouseCommand.cs |
Refactored to use effective query ID earlier in execution flow and updated logging |
ClickHouse.Driver.Tests/Misc/UriBuilderTests.cs |
Added comprehensive tests for query ID generation, caching, and uniqueness |
ClickHouse.Driver.Tests/ADO/ConnectionTests.cs |
Enhanced tests to verify GUID format and added test cases for empty string and uniqueness |
Comments suppressed due to low confidence (1)
ClickHouse.Driver/ADO/ClickHouseCommand.cs:1
- After the
uriBuilderis created and the effective query ID is generated, theQueryIdproperty ofClickHouseCommandis never updated with the auto-generated value. Users checkingcommand.QueryIdafter execution will see null instead of the GUID that was actually used. Consider addingQueryId = uriBuilder.GetEffectiveQueryId();after line 177 to populate the property with the effective value.
using System;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.