How to Configure Semantic Kernel ClickHouse Read Only Access
You set up semantic kernel clickhouse read only access by creating a restricted database user. Then you connect your AI agent plugin to the database with that user account. Many engineering teams start by giving their agent a broad admin database account. That shortcut lets a bad model prompt modify tables or drop production data. How semantic kernel clickhouse read only access works ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access objects. To turn on
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 semantic kernel clickhouse read only access by creating a restricted database user. Then you connect your AI agent plugin to the database with that user account. Many engineering teams start by giving their agent a broad admin database account. That shortcut lets a bad model prompt modify tables or drop production data.
How semantic kernel clickhouse read only access works
ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access objects. To turn on SQL access control, an admin sets a storage directory on the server. At least one admin account must hold access management rights to create new accounts. Remember that a database user can only grant privileges that they already hold themselves.
To lock down your AI agent, you first create a dedicated user account. Making this account requires the create user privilege on the ClickHouse server. During creation, you set the login method and the allowed client hosts. You also assign default roles and specific user settings for the agent.
Next, you grant read rights to that user or to its assigned role. You do not need to expose whole tables to your AI plugin. ClickHouse lets you grant select rights on specific columns inside a table. The agent can then run queries that read only those allowed columns. If the agent tries to query an unapproved column, the database blocks the query. A wildcard query for all columns also fails and returns no data at all. It only works if the table holds just the columns you granted. In versions since 24.10, a trailing asterisk grants rights by table name prefix.
Finally, you wire this restricted account into your Semantic Kernel skill or plugin. The plugin holds the database driver and sends SQL queries from the model. When the model runs a tool call, the database checks the user grants first. Any query that tries to insert, update, or drop data fails right away.
What native roles solve and what keeps the session active
Native database roles and column grants stop an AI agent from changing data. They also keep the agent out of tables it has no business reading. This setup gives you a strong baseline for any AI agent workflow.
Auditor Read-Only Access + ClickHouse Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, static database roles only check who logs in at the start. They do not inspect what individual queries return while the session is active. If an allowed column holds emails, phone numbers, card numbers, or national IDs, queries return them. A model can read those raw values and put them into a chat reply. Static credentials also live inside your app settings or secret stores. If a developer shares that key, anyone can run heavy queries from outside the app. Column grants also break when an AI model writes a lazy wildcard select query. Teams often give up on column grants and open the whole table to fix errors.
Managing credentials and query checks for AI plugins
To keep semantic kernel clickhouse read only access safe, teams separate credentials from app code. You should limit which hosts can log in with the agent user account. You should also set quotas so a bad prompt loop cannot overload the server. Quotas cap how much work the database user can do in a time window. Row policies can also filter which rows the AI agent user gets to read. Combining row policies, column grants, and quotas keeps native database permissions tight.
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 runs beside the server as a sidecar for your ClickHouse and checks native TCP queries with no change to your drivers.
With hoop.dev ClickHouse support, guardrails refuse banned queries before they run, and data masking rewrites matched string columns in results. The audit trail logs which entity types were masked and how many without storing raw values. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Why do wildcard queries fail with ClickHouse column grants?
ClickHouse blocks a select-all query when a user only has grants on specific columns. The query returns no data unless the table contains only those exact granted columns.
How do you grant read rights across multiple ClickHouse tables at once?
Since ClickHouse version 24.10, you can place a trailing asterisk on the table name. This grants select rights to all tables that match that specific name prefix.
What server settings are needed to manage ClickHouse users with SQL?
You must configure the access control storage directory on the ClickHouse server. You also need an initial user account with access management rights turned on.
Related guides
In this post