databricks/ai
advanced
Connecting…

AI functions and Vector Search in SQL

Call a model from SQL with ai_query, and keep an index in sync with Vector Search.

Lesson 24 of 24 · Databricks path

Explain it at my level

  1. Python loop
  2. ai_query
  3. Batched
  4. Endpoints
  5. Vector sync
Watch the canvas:Delta tablefilter / embeddingsai_query expressionexecutorserving endpointnew column / resultplumbing and costLive simulation
The old shape — a notebook full of plumbingsilver.tickets1M rows · body STRINGDelta tablecollect() to driverrows into Pythoncluster sits idlefor row in rows:one HTTP call, then waitbackoff · retry · resumewrite results backif the loop ever finishedhand-rolled checkpointWhat the loop costs youOne driver processsequential HTTP callsthe cluster does nothingRate limit handlingbackoff you wrote yourself429s at row 400,000Checkpoint and resumeso a crash is not a restartplumbing, not the questionThe interesting line is the model call. Everything around it was plumbing.
One model call per row, distributed and batched by the engine — then an index that keeps itself current.