How to Configure YugabyteDB Read Only User

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a yugabytedb read only user by making a login role and granting view rights on your permissions schemas. For newer tables, you also update default privileges so the role can read future data. Engineering teams often build this setup for developers, analysts, and support staff who fix bugs. When teams skip this step and share broad admin accounts, a single bad query can drop production tables. How a yugabytedb read only user works in practice YugabyteDB offers two query interfaces t

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 a yugabytedb read only user by making a login role and granting view rights on your permissions schemas. For newer tables, you also update default privileges so the role can read future data. Engineering teams often build this setup for developers, analysts, and support staff who fix bugs. When teams skip this step and share broad admin accounts, a single bad query can drop production tables.

How a yugabytedb read only user works in practice

YugabyteDB offers two query interfaces that handle user roles in different ways. The relational layer shares query processor code with PostgreSQL and uses standard role rules. The wide-column layer uses a separate permission model based on Cassandra principles. In both layers, admins start by creating a basic user account with login rights. That new account starts with zero rights to modify or read private tables.

Next, the database admin grants usage rights on the permissions database and schemas. Usage rights let the user look up objects inside the schema without reading the rows. After that, the admin grants read permissions on all existing tables and views. If the team uses Built-in roles on newer releases, they can assign a predefined read role instead. Predefined roles group these object grants together so admins do not miss individual tables.

Static table grants only cover objects that exist at the exact moment of setup. When an app migration creates a new table tomorrow, the read role cannot query it. To fix this, admins change the default privileges for the schema owner role. This rule tells the database to grant read permissions on every new table right away. You must apply this default rule for each role that runs schema migrations.

What native roles solve and what they leave open

Native read roles stop accidental writes, deletes, and schema drops during daily work. An engineer can run diagnostic queries all day without changing a single record. This setup satisfies basic audit rules that require separate accounts for viewing and changing data. It also protects the cluster from rogue scripts that try to alter table structures.

Still, a database role only checks who logs in and which tables they can read. It does not inspect what individual queries do once the session starts. A read role still exposes every column in a permitted table to the user by default. If a table holds emails, phone numbers, card numbers, or national IDs, the query returns them in plain text. Native table grants cannot rewrite matched fields in query results on the fly.

Read-Only Root Filesystem + User Provisioning (SCIM): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Shared read passwords also create operational drift across large engineering teams. Teams often put one read password into shared vaults or team chat rooms for convenience. When a contractor leaves, rotating that password breaks dashboards and scripts across the company. Also, database logs only show that the shared read role ran a query. Security teams cannot tie a specific data export back to an individual person.

Managing schema changes and multi-tenant data

As your cluster grows, managing read roles across dozens of schemas takes constant work. Teams often split customer data across different schemas or databases to keep workloads separate. Granting read permissions one schema at a time leads to human error and permission drift. Admins might grant broad catalog rights just to stop constant requests for table permissions.

Row-level security can filter rows inside the relational layer, but it adds query overhead. Every read query must run an extra policy check before returning data to the client. If an admin writes a slow policy rule, read queries can tie up cluster CPU. Teams need a way to control query results without changing database schemas or sharing static keys.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does a read only role block permissions system catalogs?

No, new roles can still read public system catalogs and view database object names by default. Admins must revoke public schema rights if they want to hide metadata from users.

Why can my read user still create temporary tables?

Database roles inherit default temp rights on the database level when they are created. You must revoke temporary table creation rights on the database to block this action.

Do read permissions carry over between the relational and wide-column APIs?

No, the two query layers use separate user tables and independent permission checks. You must create and manage read accounts in each interface on its own.

The query runs. The emails stay hidden.