How to Configure Gemini CLI Snowflake Read Only Permissions

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up gemini cli snowflake read only permissions by creating a restricted database role. You then bind that role to the credentials your terminal agent uses. Many engineering teams start by sharing their own personal login keys with local agents. When a role has broad rights, a single bad prompt can change or delete production tables. Scoping down those rights is the first step toward safer database sessions. How to set up gemini cli snowflake read only permissions The agent runs command

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 gemini cli snowflake read only permissions by creating a restricted database role. You then bind that role to the credentials your terminal agent uses. Many engineering teams start by sharing their own personal login keys with local agents. When a role has broad rights, a single bad prompt can change or delete production tables. Scoping down those rights is the first step toward safer database sessions.

How to set up gemini cli snowflake read only permissions

The agent runs commands from your local shell or calls external tool servers. When it queries your data warehouse, it uses the identity stored in your local settings. To keep the agent from changing data, you must build a dedicated role inside Snowflake. First, an admin creates a new role and a dedicated service user for the agent.

Next, the admin grants usage rights on the permissions warehouse, database, and schema to that role. Then, the admin grants select rights on the specific tables or views the agent needs. You should also set default future grants so new tables stay readable without manual updates. Never grant insert, update, drop, or truncate rights to this role.

Once the role is ready, you assign it as the default role for the agent user. You then store the user credentials in the local config file on the developer machine. When the agent starts a session with Snowflake, the database checks the assigned role. The engine blocks any write command before it can change a single row.

Why native database roles are only half the setup

Native roles in Snowflake are great at stopping write statements and table drops. They decide who can log in and which objects that identity can read. Still, a read-only role cannot see what happens inside an allowed query while it runs. Once a role has select rights on a table, it can read every column inside by default.

Production tables often hold sensitive strings like emails, phone numbers, card numbers, and national IDs. If an agent runs a broad select statement, those raw fields flow back to the terminal. From there, the agent sends the results straight to the model provider for processing. Native role permissions also cannot stop an agent from running a massive join that spikes compute bills.

Read-Only Root Filesystem + Snowflake Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static keys stored on laptops create another big risk for security teams. Developers must rotate those keys by hand and update local files across every machine. Database audit logs only show the shared service account name, not which developer ran the prompt. Teams need a way to inspect queries in flight and mask sensitive fields in results.

What to check before giving an agent warehouse roles

Before you let an AI tool query your warehouse, review your schema layout carefully. Separate public reporting tables from raw ingestion tables that hold customer secrets. Create specific views that leave out sensitive columns whenever your team can do so. Set strict resource timeouts on the warehouse assigned to the agent role.

A timeout stops runaway queries from burning credits if the model writes a bad join. Check your role hierarchy to make sure the new role does not inherit extra rights. Even with these steps, managing local secrets across a whole team takes constant work. Most teams look for a way to strip out local keys and filter data by default.

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

Can a read-only role stop an agent from reading sensitive columns?

A basic table select grant lets the user read every column in that table by default. To hide specific fields natively, you must build separate views or maintain complex masking rules per role.

What happens if the agent tries to run a drop table statement?

When you set up Snowflake with a select-only role, the database engine rejects the command right away. The agent receives a permission error in the terminal, and your table stays safe.

Why should teams avoid using personal logins for terminal agents?

Personal logins usually carry broad write permissions and admin rights across many schemas. Using a separate read-only service role limits what the agent can do if a prompt goes wrong.

The query runs. The emails stay hidden.