How to Configure Dify Bigquery Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up dify bigquery read only access with a dedicated cloud service account. You give this account roles that run query jobs and read target tables. Many teams rush this step during early testing and use broad admin keys. Broad keys let an AI agent change tables, delete rows, or read secret datasets. Scoping permissions down to read operations protects your warehouse from bad model outputs. How dify bigquery read only access works in cloud projects Dify connects to external data warehous

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 dify bigquery read only access with a dedicated cloud service account. You give this account roles that run query jobs and read target tables. Many teams rush this step during early testing and use broad admin keys. Broad keys let an AI agent change tables, delete rows, or read secret datasets. Scoping permissions down to read operations protects your warehouse from bad model outputs.

How dify bigquery read only access works in cloud projects

Dify connects to external data warehouses through tool plugins or custom API calls. When an agent needs data, the app sends a query to Google Cloud. Google Cloud checks the service account key attached to that request. To read data, the account needs two distinct types of cloud permissions. First, it needs permission to start a query job inside the project. Second, it needs permission to read the specific datasets and tables in the query. If you grant viewer access at the project level, the agent sees every dataset. Instead, grant job runner rights on the project and viewer rights on single datasets. This split keeps finance or human resources tables hidden from the AI app. The agent can still join permitted tables and return summaries to the user.

Why static cloud keys create risks for AI workflows

Setting up a read-only role stops the AI agent from dropping or changing tables. Still, cloud roles only check who logs in and which tables they touch. A static service account key sits inside the app settings until someone rotates it. Anyone who copies that key from the workspace can query your warehouse from anywhere. Read-only access also does not check what happens inside each query in flight. An agent with table access can still pull raw emails, phone numbers, or card numbers. Those sensitive fields then travel into prompt logs and external model providers. Also, a poorly written prompt can trigger a full scan across massive historical tables. One bad query from an agent loop can drive up your cloud bill fast. Every query in the cloud log shows the same shared service account name. You cannot tell which user or workflow ran a costly or sensitive read.

Best practices for safe AI warehouse queries

Teams can reduce these risks by shaping data before the agent reads it. Create authorized views in your warehouse that leave out sensitive columns. Point the AI service account to those clean views instead of raw tables. Put hard byte limits on the project or user to stop huge table scans. Rotate service account keys on a strict schedule so old credentials expire. Review query logs each week to spot strange prompt patterns from your apps.

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 read-only service account fail to run queries?

Reading table data and running a query job require two separate permissions in BigQuery. Make sure your account has both dataset viewer rights and project job user rights.

How do I stop Dify from reading every dataset in my project?

Do not assign the data viewer role at the top project level. Assign the viewer role only on the specific datasets or views the agent needs.

Can a read-only role hide emails or card numbers in query results?

Standard table viewer roles grant access to every column in a table by default. You must use restricted views, column tags, or data masking to rewrite sensitive fields.

The query runs. The emails stay hidden.