CertSafari
    Databricks Certified Context Engineer Associate· Lessons

    Domain 3 · Lesson 12/45

    Diagnosing Genie accuracy gaps from Unity Catalog metadata

    Given an underperforming Databricks agent and its associated Unity Catalog metadata, identify which missing or poorly specified metadata elements are causing the accuracy gap and select the configuration change that will have the highest impact on agent performance.

    19 min read
    2.22% of exam
    7 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • List the Unity Catalog metadata and space configuration a Genie agent reads when it writes SQL
    • Connect a Genie accuracy symptom (fan-out joins, a misread column, a mismatched value format, a wrong metric) to the metadata element that is missing or poorly specified
    • Rank candidate fixes by impact, preferring metadata and SQL over text instructions and choosing between a Unity Catalog fix and an agent-scoped fix
    • Recognise when space limits or conflicting guidance rule out a fix that would otherwise rank highest

    Key concept

    Metadata-driven SQL generation — A Genie agent writes SQL by choosing table and column names, descriptions, key relationships and sample values from Unity Catalog, plus the agent's own configuration. When an answer is wrong, the cause is usually one of those inputs that is missing, vague or misleading, so the fix is to correct that input.

    1.What a Genie agent reads before it writes SQL

    A Genie agent (formerly called a Genie space) can only be as accurate as the metadata it is given. When a business user asks a question, Genie works out which data sources are relevant and puts together context from several places. It then writes a read-only SQL query against the agent's warehouse. Genie does not look at your data model and understand it the way an analyst would. It picks the names, descriptions and relationships that seem to match the words in the question. If a column has no description, or two columns look alike, or a key relationship was never declared, Genie is left to guess.

    The inputs Genie combines to generate a response, and where each one lives
    InputWhat it contributesWhere it is maintained
    Unity Catalog table metadataTable names, descriptions, and defined primary key (PK) and foreign key (FK) relationshipsUnity Catalog
    Column names and descriptionsGenie filters these for the columns relevant to the questionUnity Catalog, optionally overridden per agent
    Knowledge store contextAgent-level descriptions, synonyms, join relationships, SQL expressions, prompt matchingThe Genie agent only
    Example SQL queriesReference answers that Genie selects when relevantThe Genie agent
    SQL functionsAll functions added to the agentUnity Catalog, attached to the agent
    InstructionsPlain-text General instructionsThe Genie agent
    Prompt and response historyThe current chat; the oldest parts are excluded when token limits applyThe conversation

    These inputs fall into two layers, and the difference matters when you choose a fix. Unity Catalog comments are attached to the securable object itself, including individual table columns, so every tool that reads the catalog sees them. The knowledge store is a collection of semantic definitions that belongs to one agent: local table and column descriptions, synonyms, join relationships, SQL expressions and prompt matching. Changes in the knowledge store never write back to the catalog. By default, an agent's table description shows the Unity Catalog description. An author can edit it for that agent and click Reset to go back to the catalog version.

    Genie can only reach the objects that are attached to the agent. Genie does not query a table or Unity Catalog function that is not attached under the agent's Sources, even if an instruction names it. If the answer to a question depends on a table that was never attached, no amount of better metadata on the attached tables will fix it.

    Checkpoint 1 of 9· Match them up

    Match each Genie input to how it behaves when the agent writes SQL

    Tap a term, then the definition that fits it.

    Sources1234

    2.Inflated totals point to missing join metadata

    A total that is an exact or near multiple of the right answer is a sign of a join problem, not a column problem. Genie learns how tables relate from two places. The first is the primary key and foreign key relationships declared in Unity Catalog. The second is the join relationships defined in the agent's knowledge store. If neither exists, Genie infers a join, and it cannot know that one order row matches many line-item rows. Summing a column from the "one" side after joining to the "many" side counts that value once per matching row.

    The fix is to declare the relationship, with its cardinality stated. Genie uses the PK and FK constraints from Unity Catalog. Any link those constraints don't cover has to be added by hand in the agent's Joins configuration, with the relationship marked One-to-One, One-to-Many or Many-to-Many. Once Genie knows that orders to order_line_items is One-to-Many, it has what it needs to avoid fanning out the order-level amounts.

    The fixes that look similar all leave the cause in place. A better description of amount is accurate but doesn't change how the join multiplies rows. A synonym for "revenue" only helps Genie choose the column, which it already chose correctly. An instruction to never join the two tables breaks every legitimate question that needs line-item detail. An example query that corrects the total after the join covers only the questions that match it. Unmatched questions keep producing inflated results.

    Checkpoint 2 of 9· Check yourself

    No primary key or foreign key constraint links orders to order_line_items in Unity Catalog, and revenue questions that join the two tables keep returning inflated totals. Which change fixes the cause for every question that uses this join, not just some of them?

    Checkpoint 3 of 9· Exam question

    A Genie space joins an orders table to an order_line_items table. When users ask for total revenue, Genie's generated SQL joins the two tables and sums the amount column from orders, producing a total several times larger than the true value because each order has multiple line items. Which configuration change addresses this?

    Sources25

    3.Wrong columns and empty filters point to column and value metadata

    When Genie filters on the wrong column, it usually means two columns look interchangeable to it. Consider a customers table with created_at and updated_at columns and no descriptions. Both are timestamps, and both could plausibly answer "how many customers signed up last month". Genie picks columns by their names and descriptions. With nothing to tell the two apart, it will sometimes pick updated_at. The best fix is a column description that states exactly what each column records: created_at is the signup time and updated_at is the last time the row was modified. Descriptions are worth the effort because they help Genie understand a column, choose it for the right questions and write more accurate SQL.

    Rewriting general instructions doesn't fix this. An instruction that tries to list every date question a user might ask will never be complete. It also becomes one more global instruction that Genie has to weigh against the rest. Sample date values don't fix it either, because both columns hold the same kind of value. Declaring a relationship between two columns of the same table doesn't help, because relationships describe how tables join to each other.

    A different symptom is a filter that runs on the right column but returns nothing. That happens when users describe a value differently from the way it is stored. Say a country column stores ISO-style codes such as AUS, USA and GBR, and users type "Australia". Genie filters country = 'Australia' and gets an empty result. Genie picked the right column, so better column-level wording won't help. The missing information is at the value level: Genie needs to know how the terms users type correspond to the values actually stored. That is the job of prompt matching. Format assistance gives Genie representative values so it can see the pattern, for example three-letter uppercase codes. Entity matching supplies curated lists of distinct values for the columns users are likely to name, such as countries or states. The most direct fix is to supply that value mapping explicitly, for example "Australia" maps to AUS.

    Telling the three column-level fixes apart
    FixWhat it tells GenieSymptom it resolves
    Column descriptionWhat a column records, preciselyGenie filters or aggregates the wrong one of two similar columns
    Column synonymOther business words that refer to the columnUsers name the column with a term Genie doesn't recognise
    Prompt matching (format assistance, entity matching)What the stored values look like and which values existFilters on the right column return empty results because the user's term differs from the stored value

    Prompt matching can also be missing without anyone switching it off. If a table has a row filter, Genie excludes the whole table from prompt matching. A column mask excludes only the masked columns. So if value matching fails on one governed table while working elsewhere, check its row filters before you write new instructions.

    Checkpoint 4 of 9· Check yourself

    Users ask for "orders shipped to Australia". The generated SQL filters country = 'Australia' on the correct column, but the country column stores codes such as AUS, USA and GBR, so the result is empty. Which change fixes this?

    Checkpoint 5 of 9· Check yourself

    A customers table has created_at and updated_at columns and neither has a description. Questions about monthly signups sometimes produce SQL that filters on updated_at. What is the highest-impact fix?

    Checkpoint 6 of 9· Exam question

    A Genie space is registered against a Unity Catalog table containing a country column that stores values like "AUS", "USA", and "GBR". Users frequently type full country names such as "Australia" in natural-language questions, and Genie fails to apply the correct filter, returning empty or incorrect results. Which configuration change will most directly fix this?

    Checkpoint 7 of 9· Exam question

    A Unity Catalog table has columns created_at and updated_at with no descriptions. When users ask "how many customers signed up last month," Genie sometimes filters on updated_at instead of created_at, producing incorrect counts. What is the highest-impact fix?

    Sources62

    4.Wrong business numbers point to missing SQL definitions

    Sometimes the joins and columns are right and the number is still wrong. In that case Genie usually doesn't know how the business defines the metric. "Open pipeline", "active customer" and "gross margin" each carry rules that column names don't reveal. Genie fills the gap with general knowledge, which may differ from your company's definition. The fix depends on how complex the definition is. A metric, filter or dimension that is used often should become a SQL expression in the knowledge store. A multi-part question with organisation-specific logic should get a complete example SQL query.

    An example query that encodes a business rule column names alone can't convey: only opportunities in the Pipeline forecast category countsql
    -- Return our current total open pipeline by region.
      -- Opportunities are only considered pipelines if they are tagged as such.
      SELECT
        a.region__c AS `Region`,
        sum(o.amount) AS `Open Pipeline`
      FROM
        sales.crm.opportunity o
        JOIN sales.crm.accounts a ON o.accountid = a.id
      WHERE
        o.forecastcategory = 'Pipeline' AND
        o.stagename NOT ILIKE '%closed%'
      GROUP BY ALL;

    Without this example, a question about "pipeline" would most likely sum every opportunity. The forecastcategory = 'Pipeline' rule is the kind of organisation-specific logic that example queries are meant to capture. When a matching question arrives, Genie can run the example as it is. When a similar question arrives, Genie borrows its structure.

    Checkpoint 8 of 9· Fill the gap

    This example query teaches Genie the company's own definition of "open pipeline", which the column names alone don't reveal. Which column completes the filter that encodes that business rule?

    -- Return our current total open pipeline by region.
      -- Opportunities are only considered pipelines if they are tagged as such.
      SELECT
        a.region__c AS `Region`,
        sum(o.amount) AS `Open Pipeline`
      FROM
        sales.crm.opportunity o
        JOIN sales.crm.accounts a ON o.accountid = a.id
      WHERE
        o. ?  = 'Pipeline' AND
        o.stagename NOT ILIKE '%closed%'
      GROUP BY ALL;

    Sources62

    5.Ranking fixes by impact

    Once you have a diagnosis, you choose among fixes that each look like they would help. Two rules decide the ranking. Structured context beats prose: descriptions, join relationships, SQL expressions and example SQL rank above text instructions, which should only be used when SQL and examples can't address the need. Fix the problem where it starts: an error caused by Unity Catalog metadata is best corrected in Unity Catalog when other consumers of that table would also benefit.

    Text instructions rank last because of how they scale. General instructions apply to every prompt, and too many of them can reduce effectiveness, especially in long conversations, because Genie may struggle to prioritise the guidance that matters most. Guidance that applies only to some questions belongs somewhere more specific: an example query, a function, or comments and metadata on the relevant table. Text instructions are the right tool for global behaviour, such as a fiscal year that starts in February or a rounding rule.

    Choosing the layer for a metadata fix
    Fix in Unity Catalog when…Fix in the agent's knowledge store when…
    The description is missing or wrong for every consumer of the tableThe wording is specific to this agent's audience or domain
    You own the table or have the privileges to edit its commentsYou can edit the agent but not the underlying table
    An ALTER on the table won't disrupt the pipelines and jobs that use itYou need fast iteration without touching shared objects

    A fix made at the source carries a cost. Saving a comment in Unity Catalog runs an ALTER command, which can disrupt pipelines and jobs. AI-generated comments can produce descriptions for every column quickly, but the model writes them from the schema and column names. That makes it least reliable in exactly the case at hand, where two columns have similar names. Review every suggestion and accept it only if it matches what you would have written yourself.

    Limits can rule out a fix that would otherwise rank first. The capacity caps covered in Genie space limits count against different budgets. Each example query, each function and the whole General instructions block counts toward 100 instructions. Table descriptions, join relationships and SQL expressions count toward 200 knowledge store snippets. If the snippet budget is already used up, a new SQL expression may be impossible.

    Two changes still work when the snippet budget is full, because both move the definition out of the snippet-counted items. A view that pre-joins related tables lets the agent attach one object in place of several, so the join relationships between them (each a snippet) are no longer needed and there is one table description instead of several. A metric view is a Unity Catalog object whose definition declares the joins, dimensions and measures itself, so metrics such as revenue are pre-defined in the data object rather than added to the agent as SQL expressions. Moving a definition into a Unity Catalog comment works for a different reason: column descriptions are not among the items that count toward the 200-snippet limit. Each route fits a different gap. Use a view or metric view when the gap is a join or a metric, and a comment when the gap is the meaning of a column.

    Conflicts can rule out a fix too. If an example query rounds to four decimals and an instruction says two, adding more guidance on either side just adds to the contradiction. Resolve the conflict first.

    Rank a fix by whether the failing questions now pass, not by how plausible it sounded. After the change, re-run the benchmark questions that exposed the gap, using the approach from Validating a Genie space with benchmark questions. Genie does not use benchmark questions or SQL as context, so a benchmark that now passes reflects the metadata change. It is not the result of Genie having seen the answer.

    Checkpoint 9 of 9· Match them up

    An agent author is weighing fixes in five situations. Pair each situation with the change that ranks highest for it.

    Tap a term, then the definition that fits it.

    Sources62471

    Sources

    (7)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Table names, descriptions, and defined primary key (PK) and foreign key (FK) relationships.”
      ↩︎ What a Genie agent reads before it writes SQL
      “combined with relevant Unity Catalog comments, metadata, and sample values from selected columns”
      ↩︎ What a Genie agent reads before it writes SQL
      “Genie does not use benchmark questions or SQL to improve its context.”
      ↩︎ Ranking fixes by impact
      “Genie selects relevant names and descriptions from annotated tables and columns to convert natural language questions to an equivalent SQL query.”
      ↩︎ Key concept
      “Knowledge store configurations are scoped to the agent and do not affect Unity Catalog metadata.”
      ↩︎ Checkpoint
    2. 2.
      “All knowledge store configurations are scoped to your Genie Agent and do not affect Unity Catalog metadata or other Databricks assets.”
      ↩︎ What a Genie agent reads before it writes SQL
      “The default table description shows the Unity Catalog metadata associated with your data asset.”
      ↩︎ What a Genie agent reads before it writes SQL
      “Join relationships: Defined table relationships for accurate JOIN statements.”
      ↩︎ Inflated totals point to missing join metadata
      “Format assistance provides representative values for all eligible columns, helping Genie understand data types and formatting patterns.”
      ↩︎ Wrong columns and empty filters point to column and value metadata
      “Entity matching provides curated lists of distinct values for up to 120 columns where users are likely to reference specific entries”
      ↩︎ Wrong columns and empty filters point to column and value metadata
      “Row filter: Genie excludes the entire table from prompt matching.”
      ↩︎ Wrong columns and empty filters point to column and value metadata
      “Focus on providing samples that highlight logic that is unique to your organization and data”
      ↩︎ Wrong business numbers point to missing SQL definitions
      “documented in the relevant table as comments or metadata”
      ↩︎ Ranking fixes by impact
      “Knowledge store snippets (200 per agent): Table descriptions, join relationships, and SQL expressions (measures, filters, and dimensions) share this limit.”
      ↩︎ Ranking fixes by impact
      “Text instructions, example SQL queries, SQL functions, column descriptions, and prompt matching settings do not count toward this limit.”
      ↩︎ Ranking fixes by impact
      “This helps Genie match user terminology to actual data values.”
      ↩︎ Exam trap 2
      “Text instructions are only for context that should be applied globally and do not fit into the other formats.”
      ↩︎ Checkpoint
    3. 3.
      “Genie does not query tables or Unity Catalog functions that are not attached, even if the agent's instructions or metadata reference them.”
      ↩︎ What a Genie agent reads before it writes SQL
    4. 4.
      “You can also add comments to table columns.”
      ↩︎ What a Genie agent reads before it writes SQL
      “Saving comments triggers an ALTER SQL command, which can disrupt Databricks pipelines and jobs.”
      ↩︎ Ranking fixes by impact
    5. 5.
      “Genie respects primary and foreign keys defined in Unity Catalog, but you must manually configure any missing links in the Joins tab.”
      ↩︎ Inflated totals point to missing join metadata
      “This prevents Genie from generating queries that explode row counts or accidentally double-count metrics.”
      ↩︎ Inflated totals point to missing join metadata
      “Explicitly stating if a relationship is One-to-One, One-to-Many, or Many-to-Many is critical.”
      ↩︎ Exam trap 1
    6. 6.
      “Genie uses Unity Catalog column names and descriptions to generate responses.”
      ↩︎ Wrong columns and empty filters point to column and value metadata
      “Quality column descriptions and synonyms help Genie understand the column better, choose it for relevant questions, and write more accurate SQL.”
      ↩︎ Wrong columns and empty filters point to column and value metadata
      “Prompt matching allows Genie to match values that are most relevant to the user's question and correct spelling issues in user prompts.”
      ↩︎ Wrong columns and empty filters point to column and value metadata
      “For example, use SQL expressions to define revenue, active_customers, gross_margin, or recent_sales.”
      ↩︎ Wrong business numbers point to missing SQL definitions
      “Avoid using text instructions to define metrics, filters, or query patterns that can be expressed through SQL.”
      ↩︎ Wrong business numbers point to missing SQL definitions
      “Use text instructions only as a last resort when SQL expressions and examples cannot address the need.”
      ↩︎ Ranking fixes by impact
      “Too many instructions can reduce effectiveness, especially in longer conversations, because Genie might struggle to prioritize the most important guidance.”
      ↩︎ Ranking fixes by impact
      “Inspect any AI-generated descriptions for accuracy and clarity, and use them only if they align with what you would manually provide.”
      ↩︎ Ranking fixes by impact
      “Metric views are particularly effective for Genie Agents because they pre-define metrics, dimensions, and aggregations.”
      ↩︎ Ranking fixes by impact
      “if text instructions specify rounding decimals to two digits, then example SQL queries must also round to two digits.”
      ↩︎ Ranking fixes by impact
      “Use text instructions only as a last resort when SQL expressions and examples cannot address the need.”
      ↩︎ Exam trap 3
      “This metadata is scoped to your Genie Agent and does not overwrite metadata stored in Unity Catalog.”
      ↩︎ Exam trap 4
    7. 7.
      “Comments are powered by a large language model (LLM) that takes into account object metadata, such as the table schema and column names.”
      ↩︎ Ranking fixes by impact

    Ready to test yourself?

    Practise Databricks Certified Context Engineer Associate in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.