Build1 distinct publisher3 min readPublished
The AI functions compose like any other SQL, which is the appeal and also the hazard. The statement that made five model calls behind a LIMIT makes one per row without it. Two meters run the whole time.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
Start with the call itself. `AI_COMPLETE` is a scalar function, so it is evaluated once per row inside the `SELECT`, composing with `WHERE`, `JOIN` and `GROUP BY` like anything else in the language [1]. That is why the walkthrough's `LIMIT 5` is doing more work than it looks like: five rows, five model calls, five prompts' worth of tokens [19]. Take the `LIMIT` off against the two-million-ticket table the author names and the same statement issues two million calls [8], which is 400,000 times the development run [20]. The SQL text itself doesn't change, and the planner has no opinion about your invoice.
The natural-language predicate deserves a second look for the same reason. `AI_FILTER` is written inside the `WHERE` clause [12], where it reads like a filter and bills like a scan, because the model has to judge a row before that row can be excluded [22]. If you want token spend to track a small result set, the cheap predicates have to reduce the input first, and whether they do is a question for the query profile rather than the tutorial.
The task-specific functions are the part I would adopt on merit. `AI_CLASSIFY` returns a value from a category list you supply, so it groups and aggregates like a normal column instead of prose you parse afterwards [11]. `AI_AGG` takes a whole column against a single prompt and, per the walkthrough, is not bound by the model context window, so there is no chunking loop to write [13]. That is good engineering. It also puts the token accounting somewhere the SQL does not show it, which argues for running it once over a week's slice and reading the usage view before you aim it at full history.
Two meters run per statement: tokens for the function, warehouse credits for the query wrapped around it [2]. The sample cost query sums `token_credits` from `CORTEX_AI_FUNCTIONS_USAGE_HISTORY` [14], so it prices the model side and is silent on the compute side [21]. Hence the advice to give AI work its own warehouse, so the credits separate in billing with no tagging scheme [5]. If that view returns nothing an hour after your first call, the walkthrough says to read it as ingestion latency rather than a missing grant [16], and the view's columns have already changed shape more than once, so check them before you build a dashboard on them [17].
Two more details cost time rather than money. `SNOWFLAKE.CORTEX_USER` is a database role and cannot be granted to a user at all, only to a role [4]. Model availability varies by region and release, which is why `SHOW CORTEX BASE MODELS` belongs before the first `SELECT` [7].
One caveat on all of it. This is a single walkthrough, and it quotes no prices, so nothing here gives you cost per row. Getting that number needs your own average prompt length, a model chosen from your own `SHOW` output [7], and one run against a slice large enough to register in the usage view [14]. The five-row example transfers as a shape. The arithmetic is yours.
Ranked by verification strength, evidence, and original report placement.
Snowflake Cortex model calls are ordinary SQL functions: they sit inside a SELECT, compose with WHERE, JOIN and GROUP BY, and run once per row.
The author recommends putting AI work on its own warehouse so the credits appear separated in billing without any extra tagging.
The author recommends granting the database role to a purpose-built role rather than something broad like ANALYST, because revoking access later is the only real spending control you have.
AI_COMPLETE takes a model name and a prompt and returns text; model availability changes by region and by release, so SHOW CORTEX BASE MODELS lists what the account can actually call.
Without a LIMIT, the statement runs one model call per row, and a table with two million tickets will happily oblige.
The author advises developing against a LIMIT and removing it only once the prompt is settled.
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · September 2, 2026
Follow any of these and your For You feed starts watching them — no settings page required.
security
ShinyHunters dumps 12.9 million Carhartt records after a refused $3.3 million ransom1 distinct publisher
security
Snowflake's passwordless deadline turns Moucka-era credential debt into a due-dated cleanup1 distinct publisher
leadership
EY Answers The AI-ROI Question With An Org Chart: One Office, One Budget1 distinct publisher
security
McKesson's 8-K locates the stolen data inside third-party applications8 distinct publishers
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
One walkthrough, easy to check, unchecked
Every billing mechanic, function name and usage view in this story traces to a single dev.to tutorial. Snowflake's documentation, pricing page and release notes are referenced in spirit — 'marked as preview in Snowflake's documentation' — but never linked or quoted, and no second publisher touches the subject. The saving grace is that the assertions are cheap to verify: anyone with an account can run SHOW CORTEX BASE MODELS and the usage query in ten minutes. Nobody in this reporting has.
No deployment behind the examples
Nothing in this story is running anywhere. The support.tickets table is illustrative, the two million rows are hypothetical, and the only query actually described as executed touches five rows. There is no customer, no query volume, no credit total and no invoice to read, so adoption cannot be scored rather than scored low.
Sells the invoice, not the magic
This is the rare AI walkthrough that spends its enthusiasm on what will go wrong. The framing sentence is about cost at scale, the capability demos are called 'the least interesting part', and the closing caveats volunteer preview instability and non-determinism. If anything the piece undersells its own findings — the stale usage view and the generational rename are the sort of detail readers pay for. The reason the reading is not more negative is one unqualified flourish about AI_AGG shrugging off the context window, and a cost query that quietly measures only half of the two meters it warned about.
No visible stake, ordinary tutorial economics
There is no disclosed relationship with Snowflake here, no referral link, and the advice actively argues for spending less: separate warehouses, narrow roles, filter before the model call. What pull remains is the developer-platform reward for sounding authoritative, and it shows up exactly where you would expect — precise claims about billing behaviour and internal view names delivered without a single citation.
Right today, dated by next release
The mechanics are plausible and internally consistent, and the author's own warnings are the reason to hold this loosely: functions are in preview, the usage view 'has changed shape more than once', and a rename already invalidated the previous generation of tutorials. A story whose value lies in exact identifiers, from CORTEX_AI_FUNCTIONS_USAGE_HISTORY to AI_CLASSIFY, is a story with a short half-life — and there is no second source to notice when it expires.