Skip to content

BigQuery as a SQL graph-source backend: query native BigQuery tables in place, with no Iceberg copy and no Trino #2182

Open

Description

@aaj3f

Today there are two ways to point Fluree at BigQuery data, and both work (I validated each live in September):

  1. BigQuery-managed Iceberg tables plus EXPORT TABLE METADATA, read from GCS — either in Direct mode or through Google's Iceberg REST catalog.
  2. The SQL graph source through Trino's BigQuery connector, live, with no copy.

Both ask something real of the data team, though. The Iceberg route needs one Iceberg copy plus a refresh/export job per table, and for a warehouse with a couple hundred curated tables that's a genuine objection, even if it can be one scheduled script looping over a table list. BigQuery's Iceberg REST catalog doesn't change that math, fwiw, since it only serves tables that are already Iceberg. The Trino route means running Trino.

My first instinct was a new native reader over the BigQuery Storage Read API (Arrow over gRPC, with selected_fields / row_restriction pushdown), but I don't think that's the right shape for us. The SQL graph source (fluree-db-sql) is already "R2RML over a remote tabular engine":

  • it has a SqlDialect enum (fluree-db-sql/src/dialect.rs:29 — Trino, Postgres, MySQL, SQLite);
  • it pushes down whole blocks, including left joins, GROUP BY and DISTINCT (capabilities, fluree-db-sql/src/plan_render.rs:766);
  • it takes its endpoint auth from the same AuthConfig the Iceberg REST catalog uses (fluree-db-sql/src/config.rs:79).

So it seems the natural fit is a BigQuery backend for the SQL graph source rather than a new scan path:

  • a SqlDialect::BigQuery (backtick identifiers, project.dataset.table names, BigQuery's literal and type rules);
  • a transport alongside the Trino client protocol, starting with jobs.query / jobs.getQueryResults over REST;
  • auth through a Google identity in AuthConfig (service account, Workload Identity Federation from AWS, the metadata server). That identity is being built for Google's Iceberg REST catalog anyway (issue coming, I'll link it here), and the SQL source inherits it for free since the two share the type.

A nice side effect vs a Storage Read API reader is that BigQuery executes the pushed joins and aggregates, rather than us streaming each table out and joining in-engine.

What I think still needs deciding before we build it:

  • Cost model. On-demand jobs bill by bytes scanned (with a per-table minimum), while the Storage Read API bills by bytes read. For selective, pushed-down queries jobs should win; for broad scans maybe not. Do we want the Storage Read API as a later fast path for large unpushed scans, or not at all?
  • Latency. Each job carries roughly a second of overhead. That's probably fine for analytical graph queries, but we should measure it against the Trino route before promising anything.
  • Dialect coverage at v1. Do we need parity with the Trino dialect's pushdown, or are projection, simple comparisons and joins enough to start?

This isn't planned for the current effort (the Google identity and a GCS-native Iceberg reader come first, and they're a prerequisite), but I wanted it written down so the "a couple hundred tables" conversation has somewhere to land. Happy to talk through any of these.

Activity

  1. added
    enhancement
    P2
    triage:needs-decision
    area:query
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:queryenhancementtriage:needs-decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions