CertSafari
    Databricks Certified Context Engineer Associate· Lessons

    Domain 3 · Lesson 13/45

    Genie Space Logic Assets: Parameterized Queries and SQL Functions

    Select which Unity Catalog objects (managed tables, views, parameterized queries, SQL functions) to curate into a Genie space for a given business domain.

    8 min read
    2.22% of exam
    5 sources
    Published 3 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Tell static example queries, parameterized example queries and Unity Catalog SQL functions apart, and pick the right one for a given question.
    • Explain which assets count as trusted assets and what users need in order to use them.
    • Keep track of a Genie space's separate limits on data objects, instructions and knowledge store snippets.

    1.Example queries: static and parameterized

    Data objects decide what a Genie space can see. The second part of curation decides how it answers. Here the curator attaches logic assets instead of data. The first is the example SQL query: a question phrased the way a user would ask it, paired with SQL that answers it. Queries can be static or parameterized. When a user asks the same question, Genie can run the example directly. When the question is only similar, Genie learns from the example's structure. Databricks advises using examples to capture logic specific to your organization, such as how this CRM decides that an opportunity counts as pipeline.

    A static example query that captures organization-specific logic: only opportunities tagged as Pipeline, excluding closed stagessql
    -- 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;

    A parameterized example adds a placeholder, written as :parameter_name. Genie fills it from the user's question at runtime, so one verified query structure can serve many variants, such as "open pipeline for EMEA" and "open pipeline for APAC". Each parameter has a data type: String (the default), Date, Date and Time, Decimal or Integer. It also has an optional comment describing valid values, which helps Genie pick the right input. Choose the type carefully. If the input doesn't match the selected type, Genie treats it as the wrong type and the results can be inaccurate.

    Checkpoint 1 of 5· Check yourself

    Which of these is NOT a supported data type for a parameter in a Genie example query?

    Sources1

    2.SQL functions: logic a query cannot hold

    Some questions involve logic too complex for a static or parameterized query. For those, register a SQL function in Unity Catalog and attach it to the space. Genie calls it with parameters taken from the user's question. Genie supports scalar functions, which return a single value, and table-valued functions, which return a table of rows. Because Genie can't see the function body, functions are the right choice when the logic is sensitive or must not drift. Since they live in Unity Catalog, other teams can reuse them too. Like tables, a function is only available if it is attached.

    Checkpoint 2 of 5· Fill the gap

    This registers a Unity Catalog SQL function that a Genie space could use. Which keyword completes the language clause?

    CREATE OR REPLACE FUNCTION my_catalog.my_schema.calculate_bmi(weight DOUBLE, height DOUBLE)
    RETURNS DOUBLE
    LANGUAGE  ? 
    RETURN
    SELECT weight / (height * height);

    Sources1

    3.Trusted assets and the permissions behind them

    Parameterized example queries and SQL functions together make up trusted assets: logic an author has verified. When Genie answers with a trusted asset, the user sees a verified answer. For a parameterized query, that label appears in chat mode only when the exact text of the query produced the response. Users can then change the parameter value and run it again. Static example queries help Genie produce correct SQL, but they are not on the trusted-asset list.

    The permissions follow from Unity Catalog. Anyone with at least CAN EDIT on the space can add or remove trusted assets. The users who ask questions need EXECUTE on every SQL function used as a trusted asset. The UDF documentation also requires USAGE on the function's schema and catalog.

    Checkpoint 3 of 5· Check yourself

    Business users get errors whenever Genie answers with an attached SQL function, but questions answered from tables work. What is the most likely gap?

    Checkpoint 4 of 5· Exam question

    A finance team's Genie space produces inconsistent monthly recurring revenue (MRR) figures because analysts across teams calculate the aggregation differently in each underlying view. Which curation approach best resolves this discrepancy going forward?

    Sources12

    4.Choosing the asset, and the limits that apply

    Which asset you pick depends on the shape of the question. For complex, multi-part or ambiguous questions, use complete example queries. When the same question comes back with different values, parameterize it so the answer is verified. When the logic can't be expressed as a query, or must stay hidden, use a SQL function. Text instructions are a last resort. Guidance that applies only to some prompts belongs in an example query or a function, not in the general text.

    These assets count against a different limit from data objects. The 50-object cap covers tables, views and metric views only. Example queries and functions count against a separate limit of 100 instructions.

    The three separate per-space limits, and what counts against each
    LimitCeilingWhat counts
    Data objects50Tables, views or metric views
    Instructions100Each example SQL query, each SQL function, and the whole General instructions block (one each)
    Knowledge store snippets200Table descriptions, join relationships and SQL expressions (measures, filters, dimensions)

    Checkpoint 5 of 5· Match them up

    Match each need to the curation asset that fits it best

    Tap a term, then the definition that fits it.

    Sources34

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Attached SQL functions and example queries use up slots in the 50-object data limit.Why is that wrong?

      The 50-object limit covers tables, views and metric views. Example queries, functions and the General instructions block each count as one instruction toward a separate limit of 100.

      Covered in Choosing the asset, and the limits that apply

    2. 2.Every example SQL query is a trusted asset that produces a verified answer.Why is that wrong?

      Trusted assets are parameterized example queries and SQL functions. A parameterized query produces a verified answer in chat mode only when its exact text was used.

      Covered in Trusted assets and the permissions behind them

    Sources

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

    1. 1.
      “Queries can be static or parameterized.”
      ↩︎ Example queries: static and parameterized
      “With parameters, Genie can take specific inputs from user questions and reuse the structure of an example query to provide verified answers.”
      ↩︎ Example queries: static and parameterized
      “If the input value does not match the selected type, Genie treats it as the incorrect type, which can lead to inaccurate results.”
      ↩︎ Example queries: static and parameterized
      “SQL functions are useful when a question involves complex logic that cannot be captured with a static or parameterized query.”
      ↩︎ SQL functions: logic a query cannot hold
      “Genie supports both scalar functions, which return a single value, and table-valued functions, which return a table of rows.”
      ↩︎ SQL functions: logic a query cannot hold
      “Functions can be shared across your teams and used by Genie to answer specific questions.”
      ↩︎ SQL functions: logic a query cannot hold
      “In chat mode, when the exact text of a parameterized query is used in a response, Genie provides a verified answer.”
      ↩︎ Trusted assets and the permissions behind them
      “Agent users must have EXECUTE permission on any SQL functions used as trusted assets.”
      ↩︎ Trusted assets and the permissions behind them
      “Each example SQL query, each SQL function, and the entire General instructions text block each count as one instruction.”
      ↩︎ Exam trap 1
      “Supported types include String, Date, Date and Time, Decimal, and Integer.”
      ↩︎ Checkpoint
      “Genie cannot view or modify the SQL used in the function, making this approach well-suited for logic that should not be surfaced or changed.”
      ↩︎ Prediction
      “If an instruction is relevant only to a subset of prompts, it should be included as an example query or function”
      ↩︎ Checkpoint
    2. 2.
      “To run a UDF, users need EXECUTE permission on the UDF.”
      ↩︎ Trusted assets and the permissions behind them
    3. 3.
      “Use example SQL queries for complex questions”
      ↩︎ Choosing the asset, and the limits that apply
      “Use text instructions only as a last resort”
      ↩︎ Choosing the asset, and the limits that apply
    4. 4.
      “You can add up to 50 tables, views, or metric views to a Genie Agent.”
      ↩︎ Choosing the asset, and the limits that apply

    Also cited

    Ready to test yourself?

    Practise Databricks Certified Context Engineer Associate in quiz mode.

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