/clickhouse-pack:clickhouse-enterprise-rbacfrom clickhouse-pack
Configures ClickHouse enterprise RBAC with SQL-based users, roles, row policies, column grants, and quotas. Use for multi-user access control, tenant isolation, and enterprise security.
Ships in clickhouse-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Implement enterprise-grade role-based access control in ClickHouse using SQL-based user management, hierarchical roles, row-level policies, column grants, quotas, and settings profiles. The workflow builds least-privilege access from the ground up: create authenticated users, compose reusable roles, then narrow visibility with row and column policies and cap resource use with quotas.
Follow the seven steps below at a high level from this file; drill into the full implementation for every SQL statement, and worked examples for two end-to-end scenarios plus audit queries.
access_management = 1 enabled (default in Cloud)GRANT OPTIONThe build-out is seven steps. Steps 1–3 (users, roles, row security) carry the core skeleton here; Steps 4–7 (column grants, quotas, settings profiles, and the application wrapper) are summarized here and fully specified in references/implementation.md.
Pick an authentication method per user: sha256_password (standard),
double_sha1_password (MySQL wire protocol), or bcrypt_password (strongest — use
for admin accounts). Restrict network reach with HOST IP and cap per-user resources
inline with SETTINGS.
CREATE USER app_backend
IDENTIFIED WITH sha256_password BY 'strong-password-here'
DEFAULT DATABASE analytics
HOST IP '10.0.0.0/8' -- Restrict to VPC
SETTINGS max_memory_usage = 10000000000, -- 10GB per query
max_execution_time = 60; -- 60s timeout
SHOW CREATE USER app_backend; -- Verify
Build leaf-level base roles (data_reader, data_writer, schema_manager), then
compose them into job roles (analyst, developer, platform_admin). Grant roles to
users and set a default role that activates on connect.
CREATE ROLE data_reader;
GRANT SELECT ON analytics.* TO data_reader;
CREATE ROLE analyst;
GRANT data_reader TO analyst; -- Composite inherits base
GRANT analyst TO app_backend;
SET DEFAULT ROLE analyst TO app_backend;
SHOW GRANTS FOR app_backend; -- Verify the full chain
Isolate multi-tenant data with row policies — each user sees only rows matching its
USING predicate. A permissive USING 1 = 1 policy lets an admin role see everything.
CREATE ROW POLICY acme_isolation ON analytics.events
FOR SELECT
USING tenant_id = 1
TO tenant_acme;
SELECT * FROM system.row_policies; -- List all policies
GRANT SELECT(col, ...) to hide PII columns and
GRANT INSERT(col, ...) to prevent metadata injection.queries, read_rows, result_rows, and execution_time
per interval so one user cannot exhaust the cluster.readonly, memory, thread, and concurrency
ceilings; a separate ETL profile enables async_insert.Full SQL and the TypeScript wrapper: references/implementation.md.
Running this workflow produces, in the target ClickHouse instance:
system.row_policies.SHOW GRANTS FOR <role>.Verify the deployment with SHOW ACCESS, SHOW GRANTS FOR <user>, and the audit
queries in references/examples.md.
| Error Code | Name | Solution |
|---|---|---|
| 497 | ACCESS_DENIED | SHOW GRANTS FOR user, add missing GRANT |
| 516 | AUTHENTICATION_FAILED | Verify password, check HOST restriction |
| 164 | READONLY | User has readonly=1, grant write if needed |
| 497 | Not enough privileges to execute GRANT | Use admin user with GRANT OPTION |
Two end-to-end scenarios — a multi-tenant SaaS isolation setup and a PII-safe analyst role — plus the access-control audit queries live in references/examples.md. The core of Example 1:
-- Each tenant reads only its own rows from a shared table
CREATE ROW POLICY acme_isolation ON analytics.events FOR SELECT USING tenant_id = 1 TO tenant_acme;
CREATE ROW POLICY globex_isolation ON analytics.events FOR SELECT USING tenant_id = 2 TO tenant_globex;
-- Connected as tenant_acme, this returns ONLY tenant_id = 1:
SELECT tenant_id, count() FROM analytics.events GROUP BY tenant_id;
For schema migrations, see the clickhouse-migration-deep-dive skill in this pack.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin clickhouse-pack24 skills in this plugin
/clickhouse-ci-integrationRun ClickHouse integration tests in CI with GitHub Actions and Docker
containers. Use when setting up automated testing against a real ClickHouse
instance, configuring CI pipelines, or implementing schema validation in CI.
Trigger with "clickhouse CI", "clickhouse GitHub Actions", "clickhouse
integration tests", "test clickhouse in CI", "clickhouse automated testing".
/clickhouse-common-errorsDiagnose and fix the top 15 ClickHouse errors — query failures, insert problems,
memory limits, and merge issues.
Use when a ClickHouse query or insert throws an exception, a server-side error
appears in logs, or a failed query needs root-cause analysis.
Trigger with "clickhouse error", "fix clickhouse", "clickhouse not working",
"debug clickhouse", "clickhouse exception", "clickhouse syntax error".
/clickhouse-core-workflow-aDesign ClickHouse schemas with MergeTree engines, ORDER BY keys, and
partitioning.
Use when creating new tables, choosing an engine, designing sort keys, or
modeling data for analytical workloads on ClickHouse or ClickHouse Cloud.
Trigger with "clickhouse schema design", "clickhouse table design",
"clickhouse ORDER BY", "clickhouse partitioning", "MergeTree table".
Other plugins' skills for the same job