Learn  /  Guides

AI functions in SQL compared: Snowflake, BigQuery and Databricks, with the same task written three ways

Labelling ten thousand support tickets used to mean a Python script, an API key and an afternoon. Today it is one line of SQL in every major warehouse. The function names differ, the return types differ, and so do the traps. Here is the map.

Guide10 min readUpdated 16 November 2026
SQLAISnowflakeDatabricks
All guides and cheat sheets

All three big data platforms now let you call a large language model from a SQL query. The model reads a column, row by row, and returns a label, a yes or no, a score or extracted fields. This week all three added something: Snowflake made its AI Function Studio generally available, BigQuery added Gemini 4 models, and Databricks shipped an asynchronous API for big batches. Here is how they compare in November 2026.

3PlatformsSnowflake, BigQuery, Databricks
500LabelsDatabricks ai_classify maximum
50,000Requestsper Databricks asynchronous batch (beta)
1Line of SQLto label a whole column

The functions side by side

TaskSnowflakeBigQueryDatabricks
Pick a categoryAI_CLASSIFYAI.CLASSIFYai_classify
Yes or no, for filteringAI_FILTERAI.IFai_classify with two labels
Score or rateAI_SENTIMENT for sentimentAI.SCOREai_analyze_sentiment for sentiment
Pull out fieldsAI_EXTRACTAI.GENERATE with an output schemaai_extract
Free text, any promptAI_COMPLETEAI.GENERATEai_query
Read documentsAI_PARSE_DOCUMENTThrough AI.GENERATE on filesai_parse_document
Summarise many rowsAI_AGGAI.GENERATE over aggregated textai_summarize per row

The same task three ways: label support tickets

A table tickets with a text column body. We want one category per ticket.

SQL
SELECT
  ticket_id,
  AI_CLASSIFY(body, ['billing', 'bug', 'feature request', 'other']):labels[0]::STRING
    AS category
FROM tickets;

AI_CLASSIFY returns an object whose labels field is an array, so we take the first element. Add {'output_mode': 'multi'} as a third argument to allow several labels, and task_description or few-shot examples in the same object to improve accuracy.

Filtering rows with a question

A yes/no function in the WHERE clause is the most useful AI feature most analysts never try. It answers questions like "which reviews mention delivery?" without keyword lists.

SQL
SELECT ticket_id, body
FROM tickets
WHERE AI_FILTER(CONCAT('Is this ticket asking for a refund? ', body));

What each platform does best

Snowflake

Tuning on your data
  • AI Function Studio (GA this week) builds, tests and tunes a function from a plain-English description
  • AI Function Optimization compares prompts and models on your data, with quality and cost
  • AI_AGG summarises across many rows in one call
  • Return types are objects you need to unpack

Best when you will run the same AI task every day and want it tuned once.

BigQuery

Least setup
  • Picks a model automatically when you name none, with a choice between lower cost and higher quality
  • AI.CLASSIFY returns a simple string
  • Gemini 4 Carbon and Hydrogen available since this week
  • Model choice is mostly Google's models

Best for analysts who want results fast with no configuration.

Databricks

Most control
  • Confidence scores and reasons in ai_classify 2.1
  • ai_query calls any model served on the platform, including Claude, GPT and open models
  • Asynchronous API runs up to 50,000 requests from a file (beta)
  • More options to learn

Best for data engineers building large, repeatable AI pipelines.

Keeping the bill under control

  1. 1

    Test on a sample

    Run the function on 200 rows, check them by hand and measure accuracy before touching the full table.

  2. 2

    Use the smallest model that passes

    Classification and filtering rarely need a frontier model. On BigQuery, leave the model choice to the platform first.

  3. 3

    Store the results

    Write labels to a table once. A dashboard that calls an AI function on every refresh pays every time.

  4. 4

    Only process new rows

    Label incrementally with a WHERE on the load date or a MERGE, never the whole history again.

  5. 5

    Watch the platform's AI usage view

    Each platform reports AI spending separately from compute; set a budget alert.

When to leave SQL

If you need many closed questions per item, probabilities you can set thresholds on, or images and video in the same call, a dedicated API can be cheaper. Google's new Gemini Decisions API answers up to 1,000 yes/no, choice or score questions per call for $0.10 per million input tokens. The trade-off: the data leaves your warehouse, so check your governance rules first.

Check your understanding

1/3Which BigQuery function filters rows with a yes/no question?

2/3What does Snowflake's AI_CLASSIFY return?

3/3What is the best way to keep AI function costs low in dashboards?

More: Snowflake's November update, BigQuery's November update and Databricks Genie One's November updates.

Sources: Snowflake documentation for AI_CLASSIFY and Cortex AI Functions; BigQuery documentation for AI.CLASSIFY and the generative AI overview; Databricks documentation for ai_classify and AI Functions; Snowflake, BigQuery and Databricks release notes (9 to 16 November 2026). Function options and pricing change often, so check each platform's documentation before a large run.

Alessandro Ecclesie AgazziWritten by Alessandro Ecclesie Agazzi, analytics engineer in London. Updated 16 November 2026. About me

Found this useful?

New guides and "what's new" explainers on data and AI land here regularly. Follow along on LinkedIn, or share this one with a colleague.