10.3 Trusted Assets & Parameterized Functions
Key Takeaways
- Trusted Assets in AI/BI Genie are pre-verified SQL queries and Unity Catalog User-Defined Functions (UDFs) that guarantee 100% deterministic accuracy for critical KPIs.
- Parameterized SQL UDFs allow Genie to extract natural language arguments (such as dates, product categories, or thresholds) and pass them into validated code.
- When Genie matches a user prompt to a Trusted Asset, it executes the pre-authored UDF instead of dynamically generating SQL, eliminating LLM hallucinated logic.
- Unity Catalog SQL UDFs used as Trusted Assets must specify input parameter data types and return structured tabular or scalar results.
10.3 Trusted Assets & Parameterized Functions
In enterprise analytics, certain calculations—such as official financial earnings, regulatory compliance metrics, or complex customer churn algorithms—cannot tolerate LLM generation variance. While dynamic SQL translation handles ad-hoc exploration effectively, business-critical KPIs demand deterministic execution. Databricks AI/BI Genie addresses this requirement through Trusted Assets: pre-verified, published SQL assets and parameterized Unity Catalog User-Defined Functions (UDFs) that Genie executes directly whenever relevant natural language prompts are detected.
Understanding Trusted Assets in AI/BI Genie
A Trusted Asset is a curated, analyst-approved data object linked to a Genie space. When an end user asks a question that matches the semantic scope of a Trusted Asset, Genie bypasses dynamic SQL generation and executes the trusted code path instead.
+-----------------------------------+
| User Natural Language |
| "Calculate ARR for Q1 2026" |
+-----------------------------------+
|
v
/-----------------------------\
/ Genie Intent Engine \
\ Matches Trusted Asset Scope? /
\-------------------------------/
/ \
YES / \ NO
v v
+------------------------+ +------------------------+
| Execute Verified UDF | | Dynamic SQL Generation |
| - 100% Deterministic | | - LLM Constructs SQL |
| - Zero Hallucinations | | - Validated on DBSQL |
+------------------------+ +------------------------+
Key Advantages of Trusted Assets
- Deterministic Precision: Guarantees identical, verified SQL logic every time a specific metric is requested.
- Governance & Compliance: Ensures executive dashboards and financial reports align strictly with audited corporate definitions.
- Complex Logic Encapsulation: Enables execution of sophisticated queries involving window functions, recursive CTEs, or procedural logic that LLMs might struggle to construct dynamically.
Authoring Parameterized Unity Catalog SQL UDFs
The primary vehicle for creating flexible Trusted Assets is the Parameterized SQL Table Function (UDTF) or Scalar Function registered in Unity Catalog. SQL UDFs accept input parameters (such as date ranges, region codes, or customer identifiers) and return filtered tables or scalar metrics.
-- Creating a parameterized Unity Catalog SQL UDTF for accurate customer LTV calculation
CREATE OR REPLACE FUNCTION main.finance_gold.get_customer_ltv_by_segment(
start_date DATE,
end_date DATE,
target_segment STRING
)
RETURNS TABLE (
customer_id INT,
customer_name STRING,
segment STRING,
total_orders INT,
lifetime_value NUMERIC(18, 2)
)
COMMENT 'Trusted Asset: Calculates lifetime value (LTV) and total orders for customers in a specific segment between start_date and end_date.'
RETURN
SELECT
c.customer_id,
c.customer_name,
c.customer_segment AS segment,
COUNT(DISTINCT o.order_id) AS total_orders,
SUM(o.net_amount) AS lifetime_value
FROM main.sales_gold.dim_customers c
JOIN main.sales_gold.fact_orders o ON c.customer_id = o.customer_id
WHERE o.order_date BETWEEN start_date AND end_date
AND c.customer_segment = target_segment
AND o.order_status = 'COMPLETED'
GROUP BY c.customer_id, c.customer_name, c.customer_segment;
When authoring functions for Genie:
- Define explicit data types for all input parameters (
DATE,TIMESTAMP,STRING,INT). - Provide comprehensive function comments explaining what the function calculates and what inputs it expects.
- Ensure return table schema column names are clear and business-friendly.
Registering & Binding Trusted Assets to Genie Spaces
Once a SQL function is created in Unity Catalog, an analyst must explicitly bind it to the target Genie Space:
- Open the Genie Space Settings and navigate to the Trusted Assets tab.
- Click Add Trusted Asset and select Unity Catalog Function.
- Browse the catalog hierarchy (
catalog.schema.function_name) and select the target UDF. - Define sample natural language triggers that should route to this function (e.g., "What is the LTV for Enterprise customers in 2025?").
- Verify parameter mapping rules and publish the updated space.
-- Granting EXECUTE permission on the SQL function to space users
GRANT EXECUTE ON FUNCTION main.finance_gold.get_customer_ltv_by_segment TO ROLE analytics_users;
Parameter Extraction & Execution Mechanics
When a user submits a natural language question matching a Trusted Asset, Genie's intent parser performs argument extraction:
- Entity Recognition: Identifies entities in the prompt matching parameter types (e.g., parsing "between January 2025 and December 2025" as
start_date = '2025-01-01'andend_date = '2025-12-31'). - Value Binding: Maps extracted values to the corresponding UDF input arguments.
- Execution Call: Invokes the UDF on the Databricks SQL Warehouse:
-- Generated query executing the Trusted Asset with bound parameters
SELECT * FROM main.finance_gold.get_customer_ltv_by_segment(
CAST('2025-01-01' AS DATE),
CAST('2025-12-31' AS DATE),
'Enterprise'
);
If an optional parameter cannot be extracted from the user's prompt, Genie will either request clarification from the user or apply default values defined within the UDF signature.
Trusted Assets vs. Dynamic SQL Generation
Analysts must balance Trusted Assets and dynamic SQL generation when building enterprise Genie spaces:
| Feature Dimension | Trusted Assets (SQL UDFs) | Dynamic SQL Generation |
|---|---|---|
| Execution Mode | Pre-written, static SQL function execution | Dynamically synthesized ANSI SQL query |
| Accuracy Guarantee | 100% deterministic (0% hallucination risk) | High, subject to schema clarity & instructions |
| Flexibility | Restricted to predefined parameters & outputs | Highly flexible ad-hoc slice-and-dice queries |
| Best Use Case | Executive KPIs, audited finance, regulatory reports | Exploratory analysis, unexpected ad-hoc questions |
| Maintenance Need | Requires UDF updates if business logic shifts | Maintained via Space Instructions & Descriptions |
When should an analyst implement a Trusted Asset instead of relying on dynamic SQL generation in AI/BI Genie?
Which object type in Unity Catalog is commonly registered as a Trusted Asset to handle parameterized natural language prompts in Genie?
What occurs when Genie matches a user's natural language question to an established Trusted Asset?