BigQuery Graphs Get Measures: Trusted AI Agents
Quick answer
BigQuery Graph now supports measures, unifying metrics with relationship mapping for trusted agentic AI. Learn how to build smarter agents with zero ETL.
When enterprises move from simple chat assistants to autonomous, agentic workloads, they hit a hard truth: agents are prone to inaccurate insights when working with raw tables. Flat data is blind to the relationships that drive business outcomes.
BigQuery Graph now supports measures (preview), unifying governed metrics with relationship mapping. This lets your agents reason across complex dependencies with precision—no more guessing the why behind the what.
Why Relationships Matter
Traditional data structures miss multi-hop business context, causing agents to make poor decisions. For example, a retailer’s agent asked why winter jacket sales dropped 12% in Seattle can report the dip but can’t trace the path: Seattle orders → distribution centers → suppliers delayed by storms.
Without relationship context, the agent might suggest an irrelevant 15% markdown, eroding margins. And maintaining separate systems—one for graph relationships, another for SQL metrics—forces runtime stitching that’s slow, expensive, and inconsistent.
Measures in BigQuery Graph
Measures let you map existing tables to a property graph in-place with zero ETL. This unified setup enables a logical evolution of inquiry:
- Metadata grounding establishes what data you have.
- Business metrics (measures) calculate how your business performed.
- Relationship mapping (graph) uncovers why it happened.
Under the Hood
Historically, standard SQL joins during graph traversals duplicate rows, leading to incorrect aggregations. BigQuery Graph solves this natively.
Data modelers define a MEASURE (like SUM or AVG) directly within the Property Graph DDL. Using standard SQL via GRAPH_EXPAND and the AGG aggregator, the engine resolves structural graph paths before evaluating metrics. Your agent knows when it needs a calculator (SQL) and when it needs a map (graph).
Here’s a quick example mapping public ecommerce data:
-- 1. Map the graph inside YOUR project
CREATE OR REPLACE PROPERTY GRAPH `YOUR_PROJECT_ID.YOUR_DATASET.thelook_ecommerce_graph`
NODE TABLES(
`bigquery-public-data.thelook_ecommerce.users` AS User
KEY(id)
LABEL User PROPERTIES(id, city, country),
`bigquery-public-data.thelook_ecommerce.orders` AS Order
KEY(order_id)
LABEL Order PROPERTIES(
order_id,
MEASURE(AVG(num_of_item)) AS avg_items_per_order,
MEASURE(SUM(num_of_item)) AS total_items
)
)
EDGE TABLES(
`bigquery-public-data.thelook_ecommerce.orders` AS OrderedBy
SOURCE KEY(order_id) REFERENCES Order(order_id)
DESTINATION KEY(user_id) REFERENCES User(id)
LABEL ORDERED_BY
);
-- 2. Query your new graph with standard SQL
SELECT
User_city AS city,
ROUND(AGG(Order_avg_items_per_order), 2) AS agg_avg_items,
ROUND(AGG(Order_total_items), 2) AS agg_total_items
FROM GRAPH_EXPAND("YOUR_PROJECT_ID.YOUR_DATASET.thelook_ecommerce_graph")
GROUP BY User_city
ORDER BY agg_total_items DESC
LIMIT 10;
Democratizing Graph Intelligence in BigQuery Studio
To make managing these relationship networks frictionless, BigQuery Studio now includes native tools:
- Visual graph modeler: A no-code, drag-and-drop interface to build, edit, and map property graphs without writing complex DDL.
- Conversational Analytics (CA) integration: Users interact with the graph naturally. CA agents navigate the deterministic, relationship-aware map, converting natural language into precise GoogleSQL or ISO GQL queries—preventing hallucinations and enforcing semantic consistency.
Unified Semantics: Native Looker Integration
To avoid fragmented logic stacks, business metrics must live at the data layer. Looker (LookML) now integrates natively with BigQuery Graphs as in-database analytic models:
- Database-managed models (
sql_analytic_model_name): Point Looker directly to your BigQuery Graph to map LookML dimensions and measures to graph properties. - Looker-managed models (
derived_analytic_model): Define the graph schema inside your LookML view; Looker dynamically generates and executes the SQL DDL to maintain the graph. - Enterprise DevOps workflows: Manage the graph’s lifecycle with the Looker IDE, Git version control, and CI. Core KPIs remain identical, verified, and trusted.
BigQuery Graph with measures is a game-changer for agentic workloads. It’s like giving your capybara a clear map of the swamp—no more getting lost in the weeds. For more on how BigQuery stacks up against other platforms, check our Google Cloud review.
Original announcement published on Google Cloud.