Give a team least-privilege access
A data access policy and a custom role that let a team read one database and nothing else.
Example: the analytics team should query the analytics database on the production connection, see Monitoring and Data, and nothing else. This takes a data access policy and a custom role. You need data_access:create, roles:create and roles:assign.
1. Create the data access policy
Admin › Data access › New policy:
- Name: Prod analytics — read.
- Connection: Production.
- Allow
analytics/*. - To keep personal data out, add a deny rule
analytics/pii_*with a higher priority than the allow — the first matching rule wins. - Save.
How matching works: Data access rules.
2. Create the role
Admin › Roles › Create role:
- Role name
analytics_team, display name Analytics team. - Permissions — start from the Analyst column of the permission catalog, for example:
- Explore and query:
database:view,table:view,table:select,query:execute,query:history:view - Saved queries:
saved_queries:view,saved_queries:create,saved_queries:update - Monitoring:
logs:view,metrics:view - Data:
observe:view,data_health:view
- Explore and query:
- Data access policies: Prod analytics — read.
- Save.
3. Assign it
Admin › Users → edit each person → set the role. With SSO, map your IdP group to analytics_team instead, so new team members get it automatically.
4. Check it
Ask a team member to open Preferences › Identity & access: it lists their roles, data access and every permission they hold. Quick checks:
SELECT * FROM analytics.ordersworks;SELECT * FROM analytics.pii_customersis refused.- Other databases don't appear in the Explorer.
- Admin isn't in the dock.
Changes to the role or policy apply on their next request — no sign-out needed.
Remember
- ClickHouse's own grants on the connection user are the outer limit: CHouse UI can only narrow them.
- Tokens the team creates carry these same limits, so their CLI and agents can't do more than they can.