How to Configure OpenHands Bigquery Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up openhands bigquery read only access by pairing a viewer role with a job role. You assign both roles to a dedicated cloud service account and load its key into the agent container. Many teams first reuse an admin key or an engineer credential to test the agent. That shortcut gives the coding agent permission to change tables, drop datasets, or read private tables across the project. Setting strict viewer permissions stops the agent from modifying or deleting your cloud warehouse tables

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 openhands bigquery read only access by pairing a viewer role with a job role. You assign both roles to a dedicated cloud service account and load its key into the agent container. Many teams first reuse an admin key or an engineer credential to test the agent. That shortcut gives the coding agent permission to change tables, drop datasets, or read private tables across the project. Setting strict viewer permissions stops the agent from modifying or deleting your cloud warehouse tables.

How openhands bigquery read only access works in cloud projects

OpenHands runs tasks inside an isolated container that executes scripts and queries on your behalf. When the agent needs warehouse data, it uses standard cloud client libraries inside that workspace. Those libraries look for a credential file path stored in the container settings. To make this work, you create a dedicated service account in your cloud project. A data warehouse needs two distinct permission types to run a select query. First, the account needs permission to start a query job in the project. Second, the account needs permission to read the specific datasets or tables in that query. If you grant only the data viewer role, the agent cannot run any query jobs. If you grant only the job role, the agent cannot read any table rows. You bind the data viewer role at the dataset level rather than the whole project. This choice limits the agent to the exact tables needed for its task. You then mount the service account key file into the agent runtime as a read-only file.

What native cloud roles solve and what they miss

Cloud identity roles do a great job of blocking write commands at the storage layer. With viewer roles in place, the agent cannot drop tables, insert rows, or alter schemas. The cloud platform rejects any statement that tries to change data inside the dataset. Still, cloud roles only check who logs in and which tables they can read. They do not inspect the content of individual queries or the rows that come back. An autonomous agent can still run a huge table scan that drives up cloud billing costs. Even worse, a dataset often mixes safe columns with sensitive user fields in the same table. Once the service account has viewer access to a table, it reads every row and column. If that table holds emails, phone numbers, card numbers, or national IDs, the query returns them. The agent then pulls those raw fields into its workspace and sends them to external language models. Static key files on engineer laptops or build servers also create a key rotation burden for your security team.

Managing agent queries and sensitive fields in flight

Teams running autonomous coding agents need controls that work at the query and column level. Start by separating training and analytical tables from tables that store customer records. You can also set cloud project quotas to cap the bytes scanned per day by the agent account. This step keeps a looping agent prompt from running expensive full-table scans all night. Beyond cloud quotas, teams need a way to inspect SQL statements before they reach the warehouse. Inspecting queries in flight lets you block risky joins or unapproved table reads right away. Data masking is the second vital control for agent workflows. When a query runs, masking rewrites matched fields in results such as emails or card numbers. The agent still gets valid table structures and sample rows to write its code. At the same time, raw customer records stay out of prompt logs and model context windows.

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.

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 beside the service as an open-source proxy, a sidecar for your database or API.

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 review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Why does my agent fail to run queries when it has the data viewer role?

The data viewer role only lets an account read table data, not start compute jobs. You must also grant a job runner role so the account can submit queries.

Should I grant viewer access at the project level or the dataset level?

Always grant viewer access at the dataset or table level for autonomous agents. Project-level access lets the agent read every dataset in the project, including private tables.

Can native cloud roles hide specific columns like emails or phone numbers?

Standard viewer roles apply to whole tables or datasets, not individual text fields. To hide emails or card numbers in results, you need column policy tags or runtime data masking.

The query runs. The emails stay hidden.