BigQuery Semantic Layer with Bonnard

Connect Bonnard to BigQuery and ship governed metrics to AI agents, dashboards, and your product. YAML semantic layer with MCP and React SDK.

5 min read

Bonnard gives you a BigQuery semantic layer defined in YAML, version-controlled, and queryable from AI agents, React components, and REST APIs. BigQuery handles petabyte-scale analytics with pay-per-query pricing. Bonnard connects directly and exposes governed metrics through MCP, React SDK, REST API, and markdown dashboards.

How does Bonnard connect to BigQuery?

Add BigQuery as a datasource in your Bonnard project. Define the connection in your datasources.yml:

# datasources.yml
datasources:
  - name: bigquery_warehouse
    type: bigquery
    project_id: your-gcp-project
    credentials: ${GOOGLE_APPLICATION_CREDENTIALS}
    dataset: analytics
    location: US

Then run:

bon datasource add bigquery_warehouse
bon deploy

Bonnard authenticates with your GCP service account, introspects your dataset, and deploys your semantic layer. No additional infrastructure. Your BigQuery data is queryable through every Bonnard surface within minutes.

What do you get?

Once connected, your BigQuery data is available through four surfaces:

MCP server. Run bon mcp and your AI agents (Claude, ChatGPT, Cursor) query governed BigQuery metrics with row-level security. Generate publishable keys per tenant for customer-facing agentic analytics.

React SDK. Drop BarChart, LineChart, and BigValue components into your product. Every chart queries your BigQuery dataset through the semantic layer with multi-tenant access controls applied automatically.

REST API. Query metrics programmatically from any language or platform. Type-safe queries with the TypeScript SDK or raw HTTP from anywhere.

Markdown dashboards. Author dashboards in markdown, deploy with bon deploy, and share governed views with your team or customers.

How does Bonnard compare to native BigQuery analytics?

Capability BigQuery native Bonnard + BigQuery
Metric definitions SQL views, saved queries YAML semantic layer (version-controlled)
AI agent access Vertex AI (separate setup) MCP server with publishable keys
Embedded analytics Looker Studio (separate product) React SDK with multi-tenant auth
Dashboards Looker Studio Markdown dashboards, deployed via CLI
Multi-tenancy IAM + dataset permissions Publishable keys + row-level security
Pre-aggregation Materialized views (manual) Automatic pre-aggregation cache
dbt integration Native dbt support bon datasource add --from-dbt imports models
Access control IAM roles YAML-defined RBAC + audit logging
Cost control Slot reservations Pre-aggregation reduces query volume

BigQuery-specific optimization

Cost control with pre-aggregation

BigQuery charges per byte scanned (on-demand) or per slot-second (editions). Either way, fewer queries against raw tables means lower costs. Pre-aggregation caches your most common metric queries as materialized tables. A daily revenue rollup that scans 500 GB once per hour serves hundreds of dashboard and AI agent queries from cache for the rest of the hour. For teams with large datasets, pre-aggregation can reduce BigQuery spend by 10-100x on frequently queried metrics.

Partitioning and clustering alignment

BigQuery tables partitioned by date or clustered by key columns are already optimized for analytical queries. Bonnard's pre-aggregation layer takes this further: it pre-computes aggregations so queries don't scan the table at all. For queries that fall through to BigQuery (cache miss), the semantic layer generates SQL that aligns with your partitioning and clustering to minimize bytes scanned.

Looker Studio vs Bonnard on BigQuery

Looker Studio is Google's free dashboarding tool for BigQuery. It's good for internal dashboards. It doesn't support multi-tenancy for B2B products, has no AI agent integration, and doesn't provide an SDK for embedding charts in your own application. If you need more than internal dashboards from your BigQuery data, a semantic layer serves those additional surfaces from the same governed metrics.

dbt + BigQuery workflow

dbt-bigquery is one of the most popular dbt adapters. The pattern: dbt transforms raw data in BigQuery on a schedule. Bonnard defines governed metrics on the resulting tables and serves them to every consumer. Import your dbt models with bon datasource add --from-dbt.

FAQ

Does Bonnard support BigQuery?

Yes. BigQuery is a first-class Bonnard datasource. Standard and Enterprise editions are supported. Point Bonnard at your GCP project and dataset, provide a service account, and deploy.

How does authentication work with BigQuery?

Bonnard uses Google Cloud service account credentials. Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to your key file path, or pass the credentials inline. Workload Identity Federation is also supported for keyless authentication.

Can I reduce BigQuery costs with Bonnard?

Yes. The pre-aggregation cache stores frequently queried metrics. Instead of running full table scans on every request, repeated queries hit the cache. Define rollups in your cube YAML files and Bonnard builds them automatically.

Can I import dbt models from BigQuery?

Yes. Run bon datasource add --from-dbt pointed at your dbt project. Bonnard imports your models as cubes and your metrics as measures. Layer the semantic layer on top of your existing dbt transformations without duplicating logic.

Related

Connect BigQuery. Ship governed analytics.

Define your metrics in YAML, connect to BigQuery, and expose governed analytics through MCP, React SDK, and REST API.