Conversation
`clickhousectl local client --name dev` looks up the named server's TCP port and passes it to clickhouse-client automatically. Defaults to "default" if --name is not specified. Errors if the server is not running. Also fixes a stale `local run client` reference in CLAUDE.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds support for connecting clickhousectl local client to a running local server by its configured name, enabling automatic TCP port lookup for named servers (Issue #16).
Changes:
- Add
--name/-noption toclickhousectl local client(defaulting to"default"). - Look up the named running server’s TCP port and pass it to the ClickHouse client invocation.
- Update docs (README usage examples; fix stale command reference in
CLAUDE.md).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/main.rs | Implements server lookup by name and injects the discovered TCP port into the client command. |
| src/cli.rs | Adds --name/-n flag to the local client subcommand and updates help text. |
| README.md | Documents new local client --name usage. |
| CLAUDE.md | Fixes an outdated local run client reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Instead of requiring passthrough (-- --query ...), these common clickhouse-client options are now proper flags on `local client`. Port is auto-detected from the named server if not explicitly set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Promotes the clickhouse-client --queries-file option as a first-class flag for executing SQL from a file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When connecting by name, use the version the server was started with (from server info) instead of the current default. This prevents client/server version mismatches when running multiple servers across different versions. Falls back to the default version only when --port is explicitly set (bypassing server lookup). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Check all servers (not just running ones) so a stopped server gets a "server not running" error instead of the misleading "not found". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Either --host or --port signals a direct connection, skipping named server lookup. --host is now Option<String> so the code can detect when it was explicitly set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CLAUDE.md: update local subcommand list (run → client), fix exec() reference to point at local client instead of old run server - README: remove clickhouse-local mention from intro (no longer exposed) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
--nameflag tolocal clientto connect to a specific named server (defaults to "default")--host,--port,--query, and--queries-fileas first-class flags instead of requiring passthrough--portis not explicitly setUsage
Test plan
local server startthenlocal clientconnects to "default" on correct portlocal server start --name dev --tcp-port 9001thenlocal client --name devconnects on port 9001local client --name nonexistenterrors with "Server not found"local server start --name test,local server stop test, thenlocal client --name testerrors with "Server not running"local client --query "SELECT 1"executes and returns resultlocal client --queries-file test.sqlexecutes queries from filelocal client --host localhost --port 9000connects using explicit host/port (bypasses server lookup)local clientstill uses version A)🤖 Generated with Claude Code