Urgent.News

What's breaking now, across thousands of outlets.

AI

How to run generative AI on SQL tables with Snowflake Cortex

The question that decides whether Cortex belongs in your stack is not what it can do. It is what it costs once the table has millions of rows instead of five. That question exists because the model call is an ordinary SQL function. It sits inside a SELECT , composes with WHERE , JOIN and GROUP BY , and runs once per row. So this walkthrough goes in that order. Access first, then the functions on…

To run generative AI on SQL tables with Snowflake Cortex, start by setting up a Snowflake account in a region where Cortex is available, and a warehouse. Grant access to the AI functions through a database role called SNOWFLAKE.CORTEX_USER. Use the AI_COMPLETE function to generate text based on a model name and prompt. Limit the number of AI calls to a few rows initially to manage costs, and remove the limit when the prompt is finalized.

Utilize task-specific functions like AI_CLASSIFY for classification, AI_FILTER for filtering, and AI_AGG for aggregation to write shorter SQL queries. Monitor costs by viewing the Account Usage schema and aggregate AI function usage. Be aware of preview status for some functions and model availability, and consider materializing results for downstream tables to avoid non-determinism.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

How to Get Found on ChatGPT, Perplexity, and Gemini — A Practical Guide

Traditional SEO optimizes for a search bar. AI search optimizes for a citation. The rules are not the same. Last year a logistics company in Dubai asked me why their website traffic was dropping even…

  • AI search engines prioritize citations over traditional keywords
  • Tailor content for each AI system's unique ranking factors
  • Structured data and fresh, evidence-backed content boost visibility

OpenAI Responses API previous_response_id Instructions: Repeat Policy on Every Turn

OpenAI Responses API previous_response_id instructions have a counterintuitive boundary: the response ID carries conversation state forward, but it does not carry the prior top-level instructions . If my application uses that field for output format, tool rules, or safety constraints, turn two can quietly run without the policy I…

  • OpenAI's Responses API allows continuity without repeating entire dialogue.
  • Previousresponseid requires explicit policy in every conversation turn.
  • Guard mechanism prevents accidental omission of essential instructions.

More from Thursday 3 September →