Databricks Assistant: Write SQL and Verify the Result
Databricks Assistant is now documented as Genie Code. Open it beside your notebook or SQL work, ask for a small change, and check the result before trusting it.
Updated 5 min read
Databricks Assistant is now documented as Genie Code (opens in a new tab), the coding assistant inside the Databricks workspace. It helps write and run code, explain errors, and work with notebooks and SQL. Start with a narrow request, review the proposed query, and check what its output actually means. fenbs can keep the definitions and checks you confirm, so the next assistant starts from the work you already reviewed.
Where do you open the coding assistant?
For work on an existing notebook or query, open the Genie Code pane from the upper-right corner of the page. Databricks documents a pane with New chat, Chat history, More, and Close controls. Follow the Genie Code navigation guide (opens in a new tab) for the current interface rather than looking for an older Assistant-branded menu.
- Open the notebook or SQL work you want help with, then open the Genie Code pane in the upper-right corner.
- Enter one specific request. Name the intended output and the parts the assistant should leave alone.
- If you want an explanation before any execution, include “explain; don’t run code” in the request.
- Review the answer and proposed changes against your goal before continuing with execution.
- Use Chat history to reopen the discussion when you need to check the reasoning later.
For a full-page start, select Code in the workspace-home prompt box and submit your request, or click Maximize in the pane. These are the documented entry points. Keep the first request small enough that you can tell whether the assistant understood it; “fix the notebook” leaves too much room for assumptions.
What should you put in a SQL request?
Describe the business question before describing the output. A query for “active customers” needs a definition of active, a time range, and a rule for duplicate records. Treat those as choices you must supply or resolve, rather than details the assistant should invent from column names.
Explain how to count customers with at least one completed order in the previous calendar month. Use one row per customer and exclude test accounts. List any missing definitions before proposing SQL. Explain; don’t run code.
This example describes a task; it is not executable SQL. Replace its assumptions with the rules your team actually uses. If “completed” can mean two different things, settle that before asking for a chart or summary. A technically valid query can still answer a different question from the one your team intended.
Keep the approved meaning of a metric with the work in fenbs. That lets another assistant reuse the definition without treating an earlier draft as a settled rule.
How do you control whether code runs?
Genie Code is an autonomous assistant that can run code, not only suggest text. Its default classifier approves actions within your request, while you can instead require your own approvals. Databricks also documents asking for a conversational explanation without execution. Review the capability and permission description (opens in a new tab) before handing it a broad task.
Choose the amount of freedom for the task you have. An explanation of an error needs a different boundary from a request to change and run a notebook. State whether the goal is explanation, a proposed edit, or execution. When a step could change shared work, pause long enough to understand what will be changed and how you would check it.
Do not use a prompt as a substitute for permissions. Databricks says Genie Code only accesses permitted data, but relevant authorized context can reach the model, including schema information, code, samples, and outputs. Keep sensitive material within your organization’s approved working practices even when a query looks like a harmless example.
How do you check the query and its output?
Read the query in parts before accepting its conclusion. Start with which records enter the calculation, then look at how they are joined, grouped, and counted. For a notebook, check the inputs to the changed cell as well as its visible output. A result can look plausible while depending on an earlier assumption you have not reviewed.
- Scope: does the query use the intended sources, date range, and business unit?
- Joins: could matching several records multiply the amount or count?
- Missing values: are unknown values excluded, counted, or treated as zero deliberately?
- Boundaries: check a few records at the beginning and end of the time range.
- Comparison: calculate a small example independently and compare it with the output.
- Meaning: does the label describe what was calculated, including important exclusions?
Ask the assistant to explain disagreements, but keep the independent check independent. Repeating the same calculation in different words is weak evidence. Record what you compared, the result, and any remaining uncertainty. “Query ran” and “metric matches the agreed definition” are two different statements.
What if the feature or an expected file is missing?
Genie Code’s agentic capabilities require partner-powered AI features at account and workspace levels and a supported region. Without that feature enabled, Databricks describes a non-agentic mode using a Databricks-hosted model. Ask your workspace administrator to check those requirements rather than assuming every US workspace has the same capability. The cited instructions describe Databricks on AWS.
An attached file is normally available to the current chat and is not automatically saved as a workspace file. The navigation guide says to ask Genie Code to save a file when it should persist there. Save the reviewed artifact deliberately, then keep its location with your check results. Do not assume reopening a chat and opening a saved workspace file are the same action.
Never lose the work you did in an AI session
After a useful AI session, save it in fenbs: the key observations, findings, research and context. Then carry on from exactly where you left off, on any device and in any other AI. The next AI you connect reads it at the start of the session, so you never have to explain the same problem again.
Create a free accountFree for up to 5 people and 50 open tasks · No credit card · Works with Claude, ChatGPT, Cursor and more
How to keep checked SQL work with fenbs
Keep enough to carry on from exactly where you left off, on any device and in another AI. Save the confirmed meaning, where the reviewed query lives, what you checked, and the next step. Leave source data in its approved home; fenbs does not run your Databricks queries or validate their answers.
- Create a free account.
- Write down the question, the definition you approved, and where the checked query or notebook is saved.
- Add what you tested, what matched, and what still needs a person to check.
- Connect Databricks to fenbs with help from the person who manages your workspace.
- Before you stop, save the next step. Ask the next connected assistant to read it before changing the work.
Databricks documents governed external-tool connections for Genie Code (opens in a new tab). The fenbs connection list has no Databricks-specific guide, so ask your workspace manager to verify the setup. If you only need a one-time explanation inside a notebook, you may not need a separate work record.
Which nearby guide matches your next task?
For an outside assistant connecting to Databricks, read Databricks MCP or Claude connectors for Databricks. For retained work, see Databricks agent memory. Continue with AI/BI dashboards for a checked view, or Databricks AI functions for that separate workflow. Find more practical workflows in AI at work.