Repository navigation
Description
Today there are two ways to point Fluree at BigQuery data, and both work (I validated each live in September):
- BigQuery-managed Iceberg tables plus
EXPORT TABLE METADATA, read from GCS — either in Direct mode or through Google's Iceberg REST catalog. - 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
SqlDialectenum (fluree-db-sql/src/dialect.rs:29— Trino, Postgres, MySQL, SQLite); - it pushes down whole blocks, including left joins,
GROUP BYandDISTINCT(capabilities,fluree-db-sql/src/plan_render.rs:766); - it takes its endpoint auth from the same
AuthConfigthe 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.tablenames, BigQuery's literal and type rules); - a transport alongside the Trino client protocol, starting with
jobs.query/jobs.getQueryResultsover 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