In our previous post, Cross-cloud conversational analytics made simple with open standards, we showed how Google Cloud’s borderless Lakehouse lets you query Snowflake, Databricks and AWS Glue data in place from BigQuery. Once the data is reachable, the next step is to make sure that AI agents answer questions the same way your business does.
We see that in many organizations, each team or domain defines its key metrics in the tools it already uses. In our example, the finance team defines revenue in a Snowflake semantic view, and the marketing team defines loyalty tiers in a Databricks metric view. An agent that can query the tables but can’t see these definitions has to decide on its own what “revenue” means, and it can pick the wrong definition.
In this post, we import both semantic models into Knowledge Catalog, add a context set that links them to their Lakehouse tables and says how the two systems connect, and then ask Gemini Enterprise the same question without and with that context. As figure 1 shows, the agent looks up the business context through the Knowledge Catalog integration (Preview) in Gemini Enterprise and then queries the data through BigQuery.
Figure 1: The borderless Lakehouse provides the data, and Knowledge Catalog provides the business context, to a Gemini Enterprise agent.
Before you begin: This post uses federated Iceberg tables, set up the same way as in our cross-cloud post. We ran all the steps as a project owner. For the required APIs and roles, see the Snowflake and Databricks connector guides, Manage context sets and, for Gemini Enterprise, Connect to BigQuery.
Two teams, two definitions
Our example company, Cymbal Shop, is a fictional online store. It keeps orders and customers in Snowflake, and loyalty members and app visits in Databricks. The sample data and setup scripts are in the lakehouse-solutions repository on GitHub.
Finance defines revenue in a Snowflake semantic view. Revenue, also called net sales, counts completed orders only:
- code_block
- <ListValue: [StructValue([('code', "– Excerpt from the Snowflake semantic view SF_RETAIL_DB.SHOP.FINANCE_SALESrnMETRICS (rn orders.net_sales AS SUM(CASE WHEN status = 'COMPLETED' THEN order_amount ELSE 0 END)rn WITH SYNONYMS = ('total sales', 'spend', 'revenue')rn COMMENT = 'Net sales in USD. Completed orders only, returned orders are excluded'rn)"), ('language', ''), ('caption', )])]>
Marketing defines loyalty tiers in a Databricks metric view. Customers who aren’t loyalty members have no tier:
- code_block
- <ListValue: [StructValue([('code', '# Excerpt from the Databricks metric view dbx_retail_db.shop.customer_engagementrnjoins:rnrn – name: memberrn source: dbx_retail_db.shop.loyalty_membersrn on: source.customer_id = member.customer_idrndimensions:rnrn – name: loyalty_tierrn expr: member.loyalty_tierrn comment: Gold, Silver or Bronze. Null for customers who are not members'), ('language', ''), ('caption', )])]>
The full definitions are in the GitHub repository.
Import the semantic models into Knowledge Catalog
Knowledge Catalog’s built-in connectors import Snowflake semantic views and Databricks metric views. Each connector runs as a BigQuery Data Transfer Service job and writes the metadata to a Knowledge Catalog entry group:
-
In Snowflake and Databricks, create a read-only identity for the connector. The grants are in the GitHub repository.
-
In the Google Cloud console, go to Knowledge Catalog. In the Manage section, click Connectors, click Add connection, and select Snowflake Horizon.
-
Enter the connection details, browse to the database, and create a new entry group. We named ours
snowflake_horizon. -
Choose a schedule, or run the job on demand.
-
Repeat the steps with the Databricks Unity Catalog card and an entry group named
databricks_unity.
Figure 2: The imported FINANCE_SALES semantic view in Knowledge Catalog
Each run imports the semantic models with their formulas, descriptions, synonyms and relationships, and links them to their source tables. The imported models still use their source table names, such as SF_RETAIL_DB.SHOP.ORDERS, while the agent queries the same table in BigQuery as my-lakehouse-project.sf_retail_db.SHOP.ORDERS. Neither model says that customer_id links Snowflake customers to Databricks loyalty members. In the next step, we add both of these to a context set.
Build the context set
A context set (Preview) is a Knowledge Catalog entry group that holds the context an agent should use for a domain. You can create one in Knowledge Studio (Preview) under Context sets, where enrichment tasks propose entries for a data steward to approve.
We wanted our context set to link to the imported models rather than copy them, so we added the entries through the Knowledge Catalog API. Our context set has a root document and two folders:
-
Semantic models: one document for each model, linked to the imported model and to its Lakehouse tables.
-
Business rules: one document that says how customers relate across the two systems, linked to the
ORDERS,CUSTOMERSandloyalty_memberstables.
Figure 3: The Cymbal Shop context set and its links. (Graph)
Figure 4: The Cymbal Shop context set and its links. (Folder structure)
Agents find this context through Knowledge Catalog search, which builds on Google Search technology: it combines semantic and keyword matching, and re-ranks results with machine learning. When the agent looks up a model document, Knowledge Catalog returns the model’s metrics, including their formulas and synonyms, and the linked Lakehouse tables with their BigQuery names and schemas.
A script in the GitHub repository creates the context set, all of its documents and all nine links.
Ask Gemini Enterprise, without and with context
We connected Gemini Enterprise to BigQuery in federated query mode (Preview), which turns on the Knowledge Catalog integration automatically. We also added one sentence to the assistant instructions. In your Gemini Enterprise app, click Configurations, select the Assistant tab, select Customize under Additional LLM system instructions, enter the following sentence, and click Save and publish (see Configure the assistant):
Before writing SQL, look up the source semantic model’s own catalog entry (Snowflake or Databricks), not just the summary attached to the context set, and use its relationships and metric definitions.
Then we asked the same question twice: “What was our revenue by loyalty tier?”
Without context. First, we turned off Enable Knowledge Catalog on the same Assistant tab. The agent could still query the tables, but it couldn’t see any business definitions. It found the orders and loyalty tables and joined them, but it had to guess what revenue meant. It reported two figures: revenue from completed orders, and a “net revenue” that subtracted returned orders a second time.
Figure 5: The answer without business context: two revenue figures, one of them wrong.
With context. Then we turned the integration back on. The agent reported one revenue figure per tier. It also said where the definitions came from: the NET_SALES metric in the Snowflake semantic view, the loyalty tier in the Databricks metric view, and customer_id as the key between the two systems.

Figure 6: The answer with the semantic models and the context set: one revenue figure per tier, with its sources.
Additional considerations
-
Recreate the definitions as BigQuery measures for deterministic SQL: As an extra step, you can recreate the Snowflake and Databricks definitions as BigQuery measures on a property graph. The graph can be built on native BigQuery tables and on “Lakehouse Iceberg REST catalog tables” (Schema overview), such as the federated tables in this post. Queries then reuse the stored measure instead of rewriting its formula, and BigQuery adds graphs to the Knowledge Catalog automatically.
-
Put other cross-system rules in context set documents: For example, describe your fiscal calendar, or which system is the source of truth for each metric.
-
Control what the agent can see: Gemini Enterprise searches Knowledge Catalog with each user’s own credentials. Grant access to the context set and its tables only to the groups that should use them.
Next steps
In this post, we imported a Snowflake semantic view and a Databricks metric view into Knowledge Catalog, linked them to their Lakehouse tables in a context set, and added one document that connects the two systems. Without that context, the agent invented its own definition of revenue. With it, the agent used Finance’s definition and Marketing’s loyalty tiers, and returned the number the business reports.
To try it, follow the step-by-step lab in the lakehouse-solutions repository, and see Manage context sets. If you’re new to cross-cloud federation, start with our borderless Lakehouse post. To discuss this approach for your own data, contact your Google Cloud account team or customer engineer.