How to Configure Codex Bigquery Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up codex bigquery read only access by pairing a viewer role with a runner role. The viewer role lets the AI read tables, while the runner role starts query jobs. Teams often assign broad project roles to get an AI agent working fast. Broad roles let a bad prompt drop tables, edit rows, or scan huge datasets. How codex bigquery read only access works in cloud permissions BigQuery splits data reading and job running into two separate cloud permission checks. First, the agent identity ne

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 codex bigquery read only access by pairing a viewer role with a runner role. The viewer role lets the AI read tables, while the runner role starts query jobs. Teams often assign broad project roles to get an AI agent working fast. Broad roles let a bad prompt drop tables, edit rows, or scan huge datasets.

How codex bigquery read only access works in cloud permissions

BigQuery splits data reading and job running into two separate cloud permission checks. First, the agent identity needs permission to start a query job in the project. Second, that same identity needs permission to read the specific datasets and tables. If you only grant table reading, the agent cannot run any SQL statement. If you only grant job running, the query fails when it touches a table.

To make this work, admins create a dedicated service identity for the AI agent. They grant job running at the project level so the agent can submit queries. Then they grant data viewing on the exact datasets the agent should inspect. The agent uses this identity when its local tool or script sends SQL to BigQuery. BigQuery checks both permissions before it reads the underlying storage blocks.

This native setup stops the AI from running write statements or deleting any tables. If the model generates a drop or update command, the cloud engine blocks it right away. You also avoid sharing your personal engineer login with an automated coding tool. Every job in the cloud log shows the agent identity instead of a human name.

What native cloud roles solve and what they miss

Cloud roles decide which datasets an identity can open and whether it can write. That solves the basic problem of an AI agent changing or deleting production records. Still, native roles stop checking once the identity passes the initial dataset door. They do not inspect the content of individual SQL queries or the rows coming back.

A read-only query can still pull millions of rows of private customer records. If a table holds emails, phone numbers, card numbers, or national IDs, the agent gets them. The AI tool then sends those raw results into its prompt context to answer your question. Native dataset roles cannot rewrite matched fields in results on the fly during a query. You would have to build and maintain separate views or policy tags for every column.

Auditor Read-Only Access + Customer Support Access to Production: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static service keys also create a clear operational risk on developer laptops and build servers. For the agent to run queries, its key or token must sit in the local setup. Any other script or prompt running in that same space can read and reuse that credential. Also, shared service accounts make it hard to tie a query back to one developer. The cloud log shows the service account, not the person who prompted the AI.

Scoping datasets and controlling query costs

Read-only queries in a cloud data warehouse can still drive up high compute bills. An AI agent might write a full table scan across terabytes of historical event logs. Even without write rights, one bad join can burn through your daily query quota. Teams should scope viewer permissions to smaller datasets or sandbox projects whenever they can.

You can also set query byte limits on the project where the agent runs jobs. When a generated query tries to scan too much data, the engine cancels it early. Combining dataset scoping with job limits keeps read-only AI exploration safer and cheaper. Still, when teams need column masking or per-user tracking without managing keys, they look past static roles.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Why does a BigQuery viewer role fail to run queries on its own?

A viewer role only gives permission to read table metadata and stored data rows. Running a SQL statement creates a compute job, which requires a separate job user permission.

Can a read-only AI agent still expose sensitive customer data?

Yes, read-only access lets the agent select any column in the allowed dataset. Unless you mask fields like emails or card numbers, raw values flow into the agent context.

Should developers use their own cloud logins for Codex database tools?

No, using a personal login gives the AI every permission that the human developer holds. If that developer can edit production tables, the AI agent can also edit or drop them.

The query runs. The emails stay hidden.