Skip to content
data.co

Connecting Snowflake to Private AI Without Copying the Warehouse

How to wire Snowflake into private AI with the user's own role grants, parameterized SQL, and query-in-place patterns that leave governed rows inside the warehouse.

November 18, 2026 · Timothy Carter
Illustration of a mountain vault with a robotic arm retrieving data cubes through a narrow secure opening.

"Query-in-place" is often read as a guarantee that running an LLM on Snowflake data keeps everything private by default. It describes where the compute runs, not who checked whether the caller was allowed to see the rows the model summarized.

Cortex AI SQL and in-warehouse agents still enforce access through RBAC, row access policies, and masking, but only when the agent's SQL carries the end user's identity to the warehouse. Identity propagation, policy enforcement at query time, and warehouse-level cost attribution are the three surfaces that make the rest of this architecture hold together.

Cortex Privileges Are a Floor, Not a Ceiling

Snowflake Cortex refuses to run an AI function unless the caller holds both the account-level USE AI FUNCTIONS privilege and either the CORTEX_USER or AI_FUNCTIONS_USER database role, per Snowflake's privileges and model access reference. Model-level access is controlled the same way, through grants on model objects in the SNOWFLAKE.MODELS schema or the legacy CORTEX_MODELS_ALLOWLIST parameter.

That pair of controls is a floor. It decides whether a caller may invoke any model at all. The row filter, the masking policy, and the warehouse grant still decide what the model gets to read. If the agent calls Cortex under a shared service account, every one of those checks evaluates against that account's role, which is why access control cannot live in the prompt.

Run SQL Under the User's Identity

The cleanest way to keep Snowflake's governance intact is to run every agent query as the user who asked the question. OAuth with an external identity provider gives the agent a session token scoped to that user's role; USE ROLE on the session takes whatever role the user holds by default or by just-in-time grant.

Row access policies evaluate against the active role when the query parses. Masking policies evaluate when the column is projected. Neither cares whether an LLM called the SELECT or a BI tool did. QUERY_TAG, query ID, and ACCESS_HISTORY all land with the user's name on them, which is what lets Data.co Control attach an audit record to the exact person whose request produced it.

Service accounts are acceptable for workloads that read nothing sensitive, such as embeddings over public documentation or scheduled summaries of non-regulated tables. For anything that touches governed data, identity propagation is not optional.

Three Patterns, Three Governance Surfaces

There are three dominant patterns for putting Snowflake data in front of an AI agent. They differ most on where the data crosses a trust boundary and which governance layer evaluates when it does. The primitives Snowflake itself exposes are the ceiling on what any of these patterns can enforce once the query leaves the warehouse.

Cortex AI SQL runs model inference inside the Snowflake account; row access policies and masking apply before the completion is returned. An external agent calling Snowflake through a driver can achieve the same effect when it authenticates as the user and issues parameterized SQL, which is roughly the architecture in the MCP server for enterprise databases piece. Copying tables into an external vector database breaks that chain. Policies are evaluated once, at copy time, against whichever account did the copying.

Snowflake Governance Primitives and When They Evaluate
PrimitiveScopeEvaluated When
Dynamic data maskingColumnAt query runtime
Row access policiesRowAt query runtime
Object taggingObject hierarchyOn tag application, propagates to policies
Data classificationColumnDuring analyze and apply phases
Access historyQuery and DMLRecorded post-execution
The primitives available inside Snowflake and the layer each one operates at. Source: Flexera, 2026
Illustration of a warehouse attendant handing a sealed envelope through a slotted window without the shelves leaving the building.

Where the Credits Go in a Cortex Call

Cortex AI functions bill in AI Credits per million tokens, with input and output priced separately. For workloads that generate long completions, such as chat agents or synthesis over retrieved rows, output dominates the bill.

The split matters for how you design the agent. Retrieval-heavy architectures that stream tens of thousands of context tokens into a model and expect a short answer behave very differently, cost-wise, from a workflow that asks the model to write a long report. The chart below shows input vs output pricing for six models exposed through Cortex AISQL. The price difference between a small open-weight model and a frontier proprietary one is more than an order of magnitude on input and closer to two on output.

Cortex AI SQL Model Pricing, Input and Output Credits per 1M Tokens
Cortex AI SQL Model Pricing, Input and Output Credits per 1M Tokensllama3.1-8b: 0.1 cr; llama3.3-70b: 0.4 cr; claude-haiku-4-5: 0.6 cr; mistral-large2: 1.2 cr; openai-gpt-4.1: 1.2 cr; claude-sonnet-4-5: 1.8 crInput / 1M tokensOutput / 1M tokensllama3.1-8b0.1 cr0.1 crllama3.3-70b0.4 cr0.4 crclaude-haiku-4-50.6 cr3 crmistral-large21.2 cr3.6 cropenai-gpt-4.11.2 cr4.8 crclaude-sonnet-4-51.8 cr9 cr
Output pricing climbs faster than input, so completions dominate the bill on long-generation agents. Source: Datastudios, 2026

Account-level routing through the model allowlist is the main lever to keep a cost-sensitive team on the cheaper model. Per-query budget enforcement is harder to reason about when the model is chosen by the agent at runtime.

Warehouse Size Is a Governance Decision

Every Cortex call pulls from a Snowflake warehouse the DBA chose. Warehouse credits double at each step from X-Small to 6X-Large, so the warehouse an agent runs on is a cost lever as much as a performance lever. It is also a governance lever: a resource monitor on that warehouse caps the blast radius of a prompt that asks for "everything."

Snowflake Warehouse Credits per Hour, X-Small Through 6X-Large
Snowflake Warehouse Credits per Hour, X-Small Through 6X-LargeXS: 1 cr/hr; S: 2 cr/hr; M: 4 cr/hr; L: 8 cr/hr; XL: 16 cr/hr; 2XL: 32 cr/hr; 3XL: 64 cr/hr; 4XL: 128 cr/hr; 5XL: 256 cr/hr; 6XL: 512 cr/hr0 cr/hr1 cr/hrXS2 cr/hrS4 cr/hrM8 cr/hrL16 cr/hrXL32 cr/hr2XL64 cr/hr3XL128 cr/hr4XL256 cr/hr5XL512 cr/hr6XL
Credits double at each step up, which makes the agent's warehouse grant an effective credit ceiling. Source: Hikmah Technologies, 2026

Tie the agent warehouse to a dedicated role, attach a QUERY_TAG the auditor can filter on, and give the warehouse a resource monitor with hard-stop behavior. The result is a per-agent credit ceiling the agent cannot override, and a ledger the finance team can reconcile against the AI budget set in your private AI infrastructure plan.

Role Hierarchy Decides What the Agent Can Read

Snowflake's system role hierarchy decides which caller can inherit which privileges. ACCOUNTADMIN inherits SYSADMIN and SECURITYADMIN. SECURITYADMIN inherits USERADMIN. PUBLIC is granted to every user. An AI agent that runs as ACCOUNTADMIN therefore reads every table in the account, which is almost never the intent.

A sound deployment grants the agent a dedicated functional role that inherits from a narrow set of data access roles, and nothing wider. The EU's general-purpose AI rules, which began applying on 2 August 2025, add obligations on top, including technical documentation, downstream information-sharing, and a summary of training data. They do not override Snowflake's RBAC, but the audit evidence they require has to come from somewhere, and ACCESS_HISTORY is a reasonable place for it to start.

Snowflake System Role Inheritance
Snowflake System Role InheritanceACCOUNTADMIN -> SYSADMIN: 1; ACCOUNTADMIN -> SECURITYADMIN: 1; SECURITYADMIN -> USERADMIN: 1; SYSADMIN -> Custom data roles: 1; USERADMIN -> Custom functional roles: 1ACCOUNTADMIN2SECURITYADMIN1SYSADMIN1USERADMIN1SYSADMIN1SECURITYADMIN1USERADMIN1Custom data rol…1Custom function…1
Documented inheritance edges between Snowflake's system-defined roles, each counted once; swap from a flow-volume reading because the source documents the edges as structure, not as query traffic. Source: Select, 2026

When to Pick Each Pattern

Choose Cortex AI SQL when the data cannot leave the Snowflake account for regulatory reasons, the agent's prompts are bounded enough that model selection can be controlled centrally, and warehouse credit accounting is already how your platform team charges back AI spend.

Choose an external agent that runs query-in-place SQL when you need open-weight models Snowflake has not exposed, the agent must join Snowflake data with other sources, or your identity provider already issues the OAuth tokens that would let the agent assume the user's role.

Copy tables to an external vector store only when the data is genuinely public, the retrieval latency budget is well under what a warehouse cold-start can meet, and you have accepted that governance in the destination store is now your problem rather than Snowflake's.

Timothy Carter
Chief Revenue Officer

Timothy Carter is Chief Revenue Officer and has spent over two decades in SEO and digital marketing. At Data.co his focus is the buyer's side of private AI: what a security or data team needs to see before an AI project leaves the pilot stage, and why the hardest question is usually not which model to run but which data it is allowed to touch. He has written for Forbes, Entrepreneur, Marketing Land, Search Engine Journal and ReadWrite, and tends to start from what the buyer already knows is broken rather than from the feature list.