Skip to content

feat(bigquery): add maximumBytesBilled source config#2724

Merged
duwenxin99 merged 7 commits into
googleapis:mainfrom
Deeven-Seru:feat-2719-bigquery-max-bytes
Apr 15, 2026
Merged

feat(bigquery): add maximumBytesBilled source config#2724
duwenxin99 merged 7 commits into
googleapis:mainfrom
Deeven-Seru:feat-2719-bigquery-max-bytes

Conversation

@Deeven-Seru

@Deeven-Seru Deeven-Seru commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #2719
Summary

  • add optional maximumBytesBilled to BigQuery source config
  • apply per-query cap to dry runs and query execution
  • document and test config parsing/initialization

Testing

  • go test ./internal/sources/bigquery ./internal/tools/bigquery/...

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the BigQuery source configuration by adding a new "maximumBytesBilled" option. This feature empowers users to define a maximum amount of data (in bytes) that a BigQuery query can process, thereby providing a crucial mechanism for cost control. Queries that are projected to exceed this limit will now fail early, preventing unexpected billing. The change is integrated across query dry runs and execution, and is thoroughly documented and tested to ensure reliability and ease of use.

Highlights

  • New Configuration Option: Introduced an optional "maximumBytesBilled" field to the BigQuery source configuration, allowing users to set a per-query byte scanned cap.
  • Query Execution Control: Implemented logic to apply the "maximumBytesBilled" cap to both dry runs and actual query executions, ensuring queries exceeding the limit fail before consuming resources.
  • Documentation and Testing: Updated documentation to reflect the new configuration and added comprehensive test cases for parsing and initialization of "maximumBytesBilled".
Changelog
  • docs/en/resources/sources/bigquery.md
    • Added "maximumBytesBilled" to BigQuery source configuration examples.
    • Included "maximumBytesBilled" in the BigQuery source reference table with its description.
  • internal/sources/bigquery/bigquery.go
    • Added "MaximumBytesBilled" field to the Config struct.
    • Initialized "MaximumBytesBilled" in the Initialize method.
    • Added "MaximumBytesBilled" field to the Source struct.
    • Implemented GetMaximumBytesBilled method for the Source struct.
    • Applied MaxBytesBilled to the BigQuery query object if "MaximumBytesBilled" is configured.
  • internal/sources/bigquery/bigquery_test.go
    • Added a test case to verify parsing of "maximumBytesBilled" from YAML configuration.
    • Introduced a new test suite, TestInitialize_MaximumBytesBilled, to validate the initialization of the "MaximumBytesBilled" field.
  • internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution.go
    • Added GetMaximumBytesBilled() to the compatibleSource interface.
    • Passed the maximumBytesBilled value from the source to the bqutil.DryRunQuery function.
  • internal/tools/bigquery/bigquerycommon/util.go
    • Updated the DryRunQuery function signature to accept a maximumBytesBilled parameter.
    • Set the MaximumBytesBilled property in the BigQuery Query request during dry runs.
  • internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql.go
    • Added GetMaximumBytesBilled() to the compatibleSource interface.
    • Passed the maximumBytesBilled value from the source to the bqutil.DryRunQuery function.
  • internal/tools/bigquery/bigqueryforecast/bigqueryforecast.go
    • Added GetMaximumBytesBilled() to the compatibleSource interface.
    • Passed the maximumBytesBilled value from the source to the bqutil.DryRunQuery function.
  • internal/tools/bigquery/bigquerysql/bigquerysql.go
    • Added GetMaximumBytesBilled() to the compatibleSource interface.
    • Passed the maximumBytesBilled value from the source to the bqutil.DryRunQuery function.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a maximumBytesBilled configuration for the BigQuery source, which is a valuable addition for managing query costs. The implementation is thorough, with changes applied to the source configuration, query execution logic, tool integrations, documentation, and tests. My review includes one suggestion to enhance the robustness of the new configuration field by adding validation.

Comment thread internal/sources/bigquery/bigquery.go Outdated
@Deeven-Seru Deeven-Seru force-pushed the feat-2719-bigquery-max-bytes branch from 5558999 to acc5afb Compare March 12, 2026 13:28
@Deeven-Seru Deeven-Seru force-pushed the feat-2719-bigquery-max-bytes branch from b05f5b3 to 04d8357 Compare March 12, 2026 13:37
@Deeven-Seru

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new maximumBytesBilled configuration option for the BigQuery source to allow for cost control on queries. The implementation adds the new setting and propagates it to query executions and dry runs in the relevant tools. The changes include validation for the new setting, updated documentation, and new tests for parsing and initialization. The implementation appears correct and complete. I have reviewed the changes and found no issues.

@yathu-arulnanthy-gtg yathu-arulnanthy-gtg 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.

Nice one 🔥

@Deeven-Seru

Copy link
Copy Markdown
Contributor Author

Nice one 🔥

@yathu-arulnanthy-gtg thanks 😁

@duwenxin99

Copy link
Copy Markdown
Contributor

Hi @Genesis929, could you review this BQ change? Thanks!

@duwenxin99 duwenxin99 added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Mar 24, 2026
@shobsi shobsi requested a review from Genesis929 March 25, 2026 19:22
@nemetron

Copy link
Copy Markdown

amazing..🫡

@Deeven-Seru Deeven-Seru force-pushed the feat-2719-bigquery-max-bytes branch from 068f21f to f8aa955 Compare April 14, 2026 07:30
@duwenxin99

Copy link
Copy Markdown
Contributor

/gcbrun

@duwenxin99 duwenxin99 enabled auto-merge (squash) April 15, 2026 19:19
@duwenxin99 duwenxin99 merged commit 42f2d07 into googleapis:main Apr 15, 2026
22 checks passed
github-actions Bot pushed a commit that referenced this pull request Apr 15, 2026
Fixes #2719
Summary
- add optional `maximumBytesBilled` to BigQuery source config\n- apply
per-query cap to dry runs and query execution- document and test config
parsing/initialization
## Testing
- go test ./internal/sources/bigquery ./internal/tools/bigquery/...

---------

Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> 42f2d07
github-actions Bot pushed a commit to renovate-bot/googleapis-_-genai-toolbox that referenced this pull request Apr 15, 2026
…pis#2724)

Fixes googleapis#2719
Summary
- add optional `maximumBytesBilled` to BigQuery source config\n- apply
per-query cap to dry runs and query execution- document and test config
parsing/initialization
## Testing
- go test ./internal/sources/bigquery ./internal/tools/bigquery/...

---------

Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> 42f2d07
github-actions Bot pushed a commit to Jaleel-zhu/genai-toolbox that referenced this pull request Apr 15, 2026
…pis#2724)

Fixes googleapis#2719
Summary
- add optional `maximumBytesBilled` to BigQuery source config\n- apply
per-query cap to dry runs and query execution- document and test config
parsing/initialization
## Testing
- go test ./internal/sources/bigquery ./internal/tools/bigquery/...

---------

Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> 42f2d07
github-actions Bot pushed a commit to Deeven-Seru/mcp-toolbox that referenced this pull request Apr 16, 2026
…pis#2724)

Fixes googleapis#2719
Summary
- add optional `maximumBytesBilled` to BigQuery source config\n- apply
per-query cap to dry runs and query execution- document and test config
parsing/initialization
## Testing
- go test ./internal/sources/bigquery ./internal/tools/bigquery/...

---------

Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> 42f2d07
@Deeven-Seru

Copy link
Copy Markdown
Contributor Author

🎉

github-actions Bot pushed a commit to pepe57/genai-toolbox that referenced this pull request Apr 16, 2026
…pis#2724)

Fixes googleapis#2719
Summary
- add optional `maximumBytesBilled` to BigQuery source config\n- apply
per-query cap to dry runs and query execution- document and test config
parsing/initialization
## Testing
- go test ./internal/sources/bigquery ./internal/tools/bigquery/...

---------

Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> 42f2d07
github-actions Bot pushed a commit to bhardwajRahul/genai-toolbox that referenced this pull request Apr 16, 2026
…pis#2724)

Fixes googleapis#2719
Summary
- add optional `maximumBytesBilled` to BigQuery source config\n- apply
per-query cap to dry runs and query execution- document and test config
parsing/initialization
## Testing
- go test ./internal/sources/bigquery ./internal/tools/bigquery/...

---------

Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> 42f2d07
Yuan325 added a commit that referenced this pull request May 7, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.2.0](v1.1.0...v1.2.0)
(2026-05-07)


### Features

* Add support for HTTPS/TLS listener
([#3126](#3126))
([8bc385d](8bc385d))
* **source/bigquery:** Add maximumBytesBilled source config
([#2724](#2724))
([42f2d07](42f2d07))
* **source/cloud-storage:** Add bucket and object management tools
([#3129](#3129))
([8de9bcf](8de9bcf))
* **source/cloud-storage:** Add Cloud Storage source with list_objects
and read_object tools
([#3081](#3081))
([da27b37](da27b37))
* **source/cloud-storage:** Add write/copy/move/delete object tools
([#3139](#3139))
([b225fc4](b225fc4))
* **tools/knowledge-catalog:** Search Data Quality Scans
([#2444](#2444))
([1c63551](1c63551))


### Bug Fixes

* Allow converting string literal block with list
([#3050](#3050))
([36ab2a9](36ab2a9)),
closes [#3023](#3023)
* **mcp:** Implement router-level logger injection for MCP auth
([#3067](#3067))
([ccc7cf5](ccc7cf5))
* Prevent test.db from being created during unit tests
([#3042](#3042))
([d10d2ca](d10d2ca))
* Remove hardcoded * allowed origin for sse
([#3054](#3054))
([c4c7bd9](c4c7bd9))
* **sources/postgres:** Apply URL encoding to query string params
([#3020](#3020))
([6b860f4](6b860f4))
* **tool/looker-conversational-analytics:** OAuth token in GDA payload
fix ([#3058](#3058))
([6632d96](6632d96))
* **tools/bigquery-execute-sql:** Avoid surfacing invalid queries as MCP
500s ([#3056](#3056))
([7ed92c8](7ed92c8))
* **tools/looker:** Fix OAuth for Converational Analytics
([#3044](#3044))
([f9e3e55](f9e3e55))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
pavankrishna13 pushed a commit to pavankrishna13/genai-toolbox that referenced this pull request May 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.2.0](googleapis/mcp-toolbox@v1.1.0...v1.2.0)
(2026-05-07)


### Features

* Add support for HTTPS/TLS listener
([googleapis#3126](googleapis#3126))
([8bc385d](googleapis@8bc385d))
* **source/bigquery:** Add maximumBytesBilled source config
([googleapis#2724](googleapis#2724))
([42f2d07](googleapis@42f2d07))
* **source/cloud-storage:** Add bucket and object management tools
([googleapis#3129](googleapis#3129))
([8de9bcf](googleapis@8de9bcf))
* **source/cloud-storage:** Add Cloud Storage source with list_objects
and read_object tools
([googleapis#3081](googleapis#3081))
([da27b37](googleapis@da27b37))
* **source/cloud-storage:** Add write/copy/move/delete object tools
([googleapis#3139](googleapis#3139))
([b225fc4](googleapis@b225fc4))
* **tools/knowledge-catalog:** Search Data Quality Scans
([googleapis#2444](googleapis#2444))
([1c63551](googleapis@1c63551))


### Bug Fixes

* Allow converting string literal block with list
([googleapis#3050](googleapis#3050))
([36ab2a9](googleapis@36ab2a9)),
closes [googleapis#3023](googleapis#3023)
* **mcp:** Implement router-level logger injection for MCP auth
([googleapis#3067](googleapis#3067))
([ccc7cf5](googleapis@ccc7cf5))
* Prevent test.db from being created during unit tests
([googleapis#3042](googleapis#3042))
([d10d2ca](googleapis@d10d2ca))
* Remove hardcoded * allowed origin for sse
([googleapis#3054](googleapis#3054))
([c4c7bd9](googleapis@c4c7bd9))
* **sources/postgres:** Apply URL encoding to query string params
([googleapis#3020](googleapis#3020))
([6b860f4](googleapis@6b860f4))
* **tool/looker-conversational-analytics:** OAuth token in GDA payload
fix ([googleapis#3058](googleapis#3058))
([6632d96](googleapis@6632d96))
* **tools/bigquery-execute-sql:** Avoid surfacing invalid queries as MCP
500s ([googleapis#3056](googleapis#3056))
([7ed92c8](googleapis@7ed92c8))
* **tools/looker:** Fix OAuth for Converational Analytics
([googleapis#3044](googleapis#3044))
([f9e3e55](googleapis@f9e3e55))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p2 Moderately-important priority. Fix may not be included in next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(bigquery): add maximumBytesBilled to source config for query cost protection

5 participants