/databricks-skills:cookbook-bifrom databricks-skills
Embeds AI/BI dashboards and integrates Genie Spaces into Databricks Apps. Provides recipes for Dash, Streamlit, and Reflex.
Ships in databricks-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Embed AI/BI dashboards and integrate Genie Spaces into your Databricks App.
Embed a published AI/BI dashboard via iframe. Get the embed URL from the dashboard UI: Share > Embed iframe.
from dash import html
iframe_source = "https://workspace.azuredatabricks.net/embed/dashboardsv3/dashboard-id"
html.Iframe(
src=iframe_source,
width="700px",
height="600px",
style={"border": "none"}
)
import streamlit.components.v1 as components
iframe_source = "https://workspace.azuredatabricks.net/embed/dashboardsv3/dashboard-id"
components.iframe(src=iframe_source, height=600, scrolling=True)
import reflex as rx
import requests
from databricks.sdk.core import Config
def get_published_dashboards():
cfg = Config()
headers = {"Authorization": f"Bearer {cfg.token}"}
url = f"{cfg.host}/api/2.0/lakeview/dashboards"
response = requests.get(url, headers=headers)
response.raise_for_status()
data = response.json()
return {d.get("display_name"): d.get("dashboard_id")
for d in data.get("dashboards", []) if d.get("published")}
class AiBiDashboardState(rx.State):
dashboard_options: dict[str, str] = {}
iframe_source: str = ""
@rx.event
def on_load(self):
self.dashboard_options = get_published_dashboards()
cfg = Config()
first_id = list(self.dashboard_options.values())[0]
self.iframe_source = f"{cfg.host}/dashboardsv3/{first_id}/published?embed=true"
Use the Genie Conversations API to let users ask natural-language questions about data. Get the Genie Space ID from the URL: rooms/SPACE-ID?o=.
import pandas as pd
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
genie_space_id = "01f0023d28a71e599b5a62f4117516d4"
def get_query_result(statement_id):
result = w.statement_execution.get_statement(statement_id)
return pd.DataFrame(
result.result.data_array,
columns=[i.name for i in result.manifest.schema.columns]
)
def process_genie_response(response):
for i in response.attachments:
if i.text:
print(f"A: {i.text.content}")
elif i.query:
data = get_query_result(response.query_result.statement_id)
print(f"A: {i.query.description}")
print(f"Data: {data}")
conversation = w.genie.start_conversation_and_wait(genie_space_id, "What are the top trips?")
process_genie_response(conversation)
follow_up = w.genie.create_message_and_wait(
genie_space_id, conversation.conversation_id, "Show me the trend"
)
process_genie_response(follow_up)
import streamlit as st
from databricks.sdk import WorkspaceClient
import pandas as pd
w = WorkspaceClient()
genie_space_id = "01efe16a65e21836acefb797ae6a8fe4"
def get_query_result(statement_id):
result = w.statement_execution.get_statement(statement_id)
return pd.DataFrame(
result.result.data_array,
columns=[i.name for i in result.manifest.schema.columns]
)
def process_genie_response(response):
for i in response.attachments:
if i.text:
st.markdown(i.text.content)
elif i.query:
data = get_query_result(response.query_result.statement_id)
st.dataframe(data)
with st.expander("Show generated code"):
st.code(i.query.query, language="sql")
if prompt := st.chat_input("Ask your question..."):
st.chat_message("user").markdown(prompt)
with st.chat_message("assistant"):
if st.session_state.get("conversation_id"):
conversation = w.genie.create_message_and_wait(
genie_space_id, st.session_state.conversation_id, prompt
)
else:
conversation = w.genie.start_conversation_and_wait(genie_space_id, prompt)
st.session_state.conversation_id = conversation.conversation_id
process_genie_response(conversation)
import reflex as rx
from databricks.sdk import WorkspaceClient
import pandas as pd
w = WorkspaceClient()
genie_space_id = "01f0023d28a71e599b5a62f4117916d4"
def get_query_result(statement_id):
result = w.statement_execution.get_statement(statement_id)
return pd.DataFrame(
result.result.data_array,
columns=[i.name for i in result.manifest.schema.columns]
)
class GenieState(rx.State):
conversation_id: str = ""
prompt: str = ""
@rx.event
async def send_message(self):
if self.conversation_id:
conversation = w.genie.create_message_and_wait(
genie_space_id, self.conversation_id, self.prompt
)
else:
conversation = w.genie.start_conversation_and_wait(
genie_space_id, self.prompt
)
self.conversation_id = conversation.conversation_id
self.prompt = ""
| Recipe | Resources |
|---|---|
| Embed dashboard | AI/BI dashboard |
| Genie API | Genie Space, SQL warehouse, Unity Catalog tables |
| Recipe | Permissions |
|---|---|
| Embed dashboard | CAN VIEW on the dashboard |
| Genie API | SELECT on UC tables, CAN USE SQL warehouse, CAN VIEW Genie Space |
A workspace admin must enable dashboard embedding in Security settings for specific domains (e.g. databricksapps.com) or all domains.
databricks-sdk
pandas
Plus your framework package. Reflex Genie also needs requests for dashboard listing.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub databricks-solutions/databricks-apps-cookbook --plugin databricks-skills12 skills in this plugin
/cookbook-aimlInvoke ML models, run vector search, and connect to MCP servers from Databricks Apps. Use when the user wants to call a model serving endpoint, query a vector search index, use LLMs/embeddings, or connect to an MCP server in Dash, Streamlit, Reflex, or FastAPI./cookbook-authenticationImplement authentication in Databricks Apps: get current user info, on-behalf-of-user (OBO) auth, service principal auth, and OAuth patterns. Use when the user asks about auth, user tokens, service principals, OAuth, or OBO in Dash, Streamlit, Reflex, or FastAPI./build-appBuild Databricks Apps from this cookbook: minimum folder layout and app.yaml per framework (Dash, Streamlit, Reflex, FastAPI), multi-page wiring, docs category-first workflow then README recipes, runtime rules, combining recipes. Feature code only from repo samples and docs/docs/*.mdx. After the app runs, follow [`productionize-app-dab`](../productionize-app-dab/SKILL.md) for Databricks Asset Bundles (DABs). Do not use for AppKit, Genie App Builder, AI/BI dashboards, or coding-agent MCP config — see When not to use this skill./cookbook-computeConnect Databricks Apps to shared clusters or serverless compute using Databricks Connect. Use when the user needs to run Spark SQL or Python on a cluster from a Dash, Streamlit, or Reflex app./cookbook-external-servicesConnect Databricks Apps to external services using Unity Catalog HTTP connections and retrieve Databricks secrets. Use when the user needs to call external APIs (GitHub, Jira, Slack), set up MCP connections, or access secrets from Dash, Streamlit, or Reflex apps./productionize-app-dabFollow-up to build-app: wrap the chosen cookbook framework (Dash, Streamlit, Reflex, FastAPI) in a Databricks Asset Bundle (DAB)—framework-specific src/app layout, app.yaml commands, bundle validate/deploy/run, CI/CD secrets. Requires a working app from build-app before applying. Self-contained YAML and commands.Other plugins' skills for the same job