Skip to content

feat(bigquery): support fetching bigtable shard boundaries - #71

Closed
matt-codecov wants to merge 1 commit into
mainfrom
matth/bigquery-bigtable-shard
Closed

matt-codecov wants to merge 1 commit into
mainfrom
matth/bigquery-bigtable-shard

Conversation

@matt-codecov

@matt-codecov matt-codecov commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Allows users to specify some Bigtable parameters in their BigQuery query configuration. These will allow the BigQuery fetcher to call the SampleRowKeys API to compute shard boundaries to split large queries up. It will then run the sharded query and aggregate results before emitting them to Kafka.

I don't love teaching the BigQuery fetcher to look past BigQuery to the underlying storage backend but the alternatives all involve a ton more orchestration. I at least put the Bigtable junk behind an interface so we can pretend that this'll one day be extended for a whole array of BigQuery data sources.

Ref FS-210

@linear-code

linear-code Bot commented Jul 21, 2026

Copy link
Copy Markdown

FS-210

@matt-codecov

Copy link
Copy Markdown
Contributor Author

bugbot run
@sentry review

Comment thread py/usageaccountant/bigquery_fetcher.py Outdated
)
assert (
placeholder in query_dict["query"]
), f"sharded query must contain the {placeholder!r} placeholder"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty placeholder corrupts query

High Severity

If bigtable_shard.placeholder is an empty string, validation still passes because "" in query is always true, but query.replace("", clause) inserts the shard predicate between every character and produces invalid SQL for BigQuery.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ad2234c. Configure here.

Comment thread py/usageaccountant/bigquery_fetcher.py Outdated
)
assert (
placeholder in query_dict["query"]
), f"sharded query must contain the {placeholder!r} placeholder"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder without shard config

Medium Severity

A query may contain {shard_predicate} while bigtable_shard is omitted; parsing succeeds, but main runs the non-sharded path and sends the literal placeholder to BigQuery instead of injecting row-key predicates.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ad2234c. Configure here.

@matt-codecov
matt-codecov force-pushed the matth/bigquery-bigtable-shard branch from ad2234c to 1d896f2 Compare July 23, 2026 00:25
@matt-codecov
matt-codecov force-pushed the matth/bigquery-bigtable-shard branch from 1d896f2 to 16cb0c8 Compare July 23, 2026 00:32
@matt-codecov

Copy link
Copy Markdown
Contributor Author

bugbot run
@sentry review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

2 issues from previous reviews remain unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 16cb0c8. Configure here.

@matt-codecov
matt-codecov marked this pull request as ready for review July 23, 2026 00:37
@matt-codecov
matt-codecov requested a review from a team July 23, 2026 00:37
@matt-codecov

Copy link
Copy Markdown
Contributor Author

got some pushback on the approach so putting this in draft until we align

@matt-codecov
matt-codecov marked this pull request as draft July 27, 2026 17:22
@matt-codecov

Copy link
Copy Markdown
Contributor Author

not pursuing this approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant