Databricks DE · Topic 10.4
Business users ask data questions in plain English; Genie generates governed SQL over Unity Catalog data. A curated Genie space grounds it in your business terms — and the Conversation API makes it programmable.
▸ toggle curation to compare the answer
Mechanism: a space is bound to a set of UC tables/views and runs on a SQL Warehouse — the unit of scope, curation & permission. Trade-off: too many/messy tables dilute accuracy; aim at a focused, well-named gold domain.
-- A space points at curated gold objects; make columns self-describing. CREATE OR REPLACE VIEW gold.sales_fact AS SELECT order_id, region, net_revenue, fiscal_quarter, order_date FROM prod.sales.orders_enriched; COMMENT ON COLUMN gold.sales_fact.net_revenue IS 'Revenue after returns/discounts (finance definition)';
Mechanism: Genie maps the question to SQL using schemas + column comments + curation, runs it, and returns the SQL and result so users verify & refine. Trade-off: ambiguity → plausible-but-wrong query; fix with curation, not luck.
-- "revenue by region last quarter" → Genie generates (and shows): SELECT region, sum(net_revenue) AS revenue FROM gold.sales_fact WHERE fiscal_quarter = '2026-Q1' GROUP BY region ORDER BY revenue DESC;
Mechanism: curate with general instructions, example SQL, certified/sample questions, and defined joins & metrics so "revenue" resolves to one definition. Trade-off: ongoing upkeep — but it's what makes answers trustworthy.
-- Encode the canonical metric as a governed object everyone (incl. Genie) reuses: CREATE OR REPLACE VIEW gold.active_customers AS SELECT * FROM prod.sales.customers WHERE status = 'ACTIVE' AND last_seen >= current_date() - INTERVAL 90 DAYS; -- Space instruction: "'active customer' = rows in gold.active_customers."
Mechanism: Genie queries run as the asking user through Unity Catalog, so existing grants, row filters, and column masks apply automatically — it can't surface data the user couldn't query. Trade-off: users get different rows by grant (correct, but explain it).
-- Grant the curated domain; an existing row filter (8.3) still applies in Genie. GRANT SELECT ON VIEW gold.sales_fact TO `sales-ops`; -- ALTER TABLE prod.sales.orders_enriched -- SET ROW FILTER catalog.sec.region_filter ON (region); -- scopes rows per user
Mechanism: drive a space from code — start a conversation, send follow-ups, poll the message until done. Trade-off: start a new conversation per session (reuse bleeds context); poll every 1–5 s, cap ~10 min. ⚠️ verify the API version against docs.
# Start a conversation in a space (verified path, API 2.0): curl -X POST \ https://<host>/api/2.0/genie/spaces/<space_id>/start-conversation \ -H "Authorization: Bearer $DATABRICKS_TOKEN" \ -d '{"content": "What was revenue by region last quarter?"}' # Follow-up: POST .../spaces/<space_id>/conversations/<conversation_id>/messages # Poll the message until status = COMPLETED / FAILED / CANCELLED.
Mechanism: a generic chatbot answers from training data; Genie is grounded — it answers only by generating SQL over your governed tables, shows the query, and respects UC. Trade-off: it won't answer beyond its data (by design); review SQL for key decisions.
| Databricks Genie | Generic LLM chatbot | |
|---|---|---|
| Source of truth | your UC tables (live) | training data / prompt |
| Output | SQL + result (verifiable) | prose (opaque) |
| Governance | UC grants/filters/masks | none |
| Accuracy lever | curation (metrics, instructions) | prompt engineering |