How to Configure GitHub Copilot ClickHouse Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up github copilot clickhouse credentials by creating a read-only SQL user in ClickHouse. You then pass that user login string to the tool or server that runs queries. Engineering teams often connect AI coding tools to analytics tables so agents can inspect schemas. Still, many developers take a shortcut and reuse an admin login string from a local file. When an AI coding agent uses broad permissions, a single bad query can drop tables. It can also pull sensitive customer records into the

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up github copilot clickhouse credentials by creating a read-only SQL user in ClickHouse. You then pass that user login string to the tool or server that runs queries. Engineering teams often connect AI coding tools to analytics tables so agents can inspect schemas. Still, many developers take a shortcut and reuse an admin login string from a local file. When an AI coding agent uses broad permissions, a single bad query can drop tables. It can also pull sensitive customer records into the chat context.

How to set up github copilot clickhouse credentials with SQL roles

ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access entities. Before you create a login for an AI tool, you must turn on SQL access control. This setup needs a storage directory on the server. It also needs at least one initial account with user management rights turned on. Once you enable this mode, an admin can create a dedicated user and role.

In ClickHouse, a user can only grant privileges that they already hold themselves. Creating the new account takes the user creation privilege. During this step, you define how the account logs in and which hosts can connect. You also assign default roles and specific user settings for that account. Teams should restrict the allowed hosts so the login works only from trusted network addresses.

Next, you assign read privileges to the role instead of granting full table rights. ClickHouse lets you grant read rights on specific columns within a table. If you grant read rights on two columns, the agent can query only those two columns. Any query that asks for a third column will fail right away. A wildcard query across all columns will also fail and return no data at all. The wildcard query works only if the table holds just the granted columns. Since version 24.10, you can also use a trailing asterisk to grant rights by table name prefix.

How AI coding agents use database login strings

AI coding agents reach external databases through protocol servers or local shell commands. When you set up a database tool for your agent, you supply a login string. Vendor guides advise teams to use a read-only database user in that login string. This step stops the queries that the agent runs from changing or deleting stored data.

When the agent needs schema details or sample rows, it sends a query through the tool. If the agent uses a local shell tool, it can also run command-line database clients. In manual approval modes, the editor asks the developer before running most shell commands. Still, developers often approve prompts fast when they are trying to fix a bug. Scoping the database account ensures that an approved command cannot alter production tables.

Ephemeral Credentials + ClickHouse Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native database roles solve and what they leave open

Native ClickHouse roles and column grants solve the first half of the access problem. They decide who can log in and which tables or columns that user can read. They also cap resource use through quotas and settings profiles. This blocks an AI agent from modifying records or reading restricted columns that you left out.

Still, static database logins leave major operational gaps open during daily work. First, the login password or key still sits in a local file on the developer laptop. Any local script or agent tool with file read rights can copy that secret. Second, column grants are all or nothing for the columns that the agent must query. If a support table mixes order notes with emails or phone numbers, a column grant cannot help. Granting read rights on that column sends raw emails, card numbers, and national IDs to the model. Third, static users do not require a human peer to approve a single risky query in flight. Native setup checks who logs in at the start, not what each statement returns in real time.

Add runtime guardrails and masking beside ClickHouse

Database grants and network rules control who can reach ClickHouse. Even so, an allowed client or agent can send an alter mutation that deletes rows or read raw personal data. In practice, hoop.dev sits inline in the native TCP protocol beside the server as a sidecar for your ClickHouse. For every production query an agent or human sends, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev ClickHouse support, guardrails refuse banned queries before they run or hold risky calls for approval, and data masking rewrites matched string columns in results in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Can a ClickHouse user run wildcard queries with column grants?

No, a wildcard select query fails and returns no data when column grants restrict the table. The wildcard query works only if the table contains just the specific columns granted to that user.

How do you limit which machines can use the database login?

When you create the user in ClickHouse, you can define the allowed client hosts. This rule limits logins to specific IP addresses or hostnames that you trust.

What happens if an AI agent reads a column with personal data?

Native column grants allow or block the entire column for that database user. To hide emails, phone numbers, or card numbers inside a column, you need data masking that rewrites matched fields in results.

The query runs. The emails stay hidden.