Skip to content

feat(bigquery): add proxy support for API calls - #2941

Closed
Deeven-Seru wants to merge 1 commit into
googleapis:mainfrom
Deeven-Seru:fix-2766-bq-proxy
Closed

feat(bigquery): add proxy support for API calls#2941
Deeven-Seru wants to merge 1 commit into
googleapis:mainfrom
Deeven-Seru:fix-2766-bq-proxy

Conversation

@Deeven-Seru

@Deeven-Seru Deeven-Seru commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add optional proxy field to BigQuery source config
  • route BigQuery client + REST service through proxy-aware HTTP client (uses
    explicit proxy or HTTP(S)_PROXY)
  • document proxy option in BigQuery source docs

This wasn’t supported yet — BigQuery client creation didn’t wire proxy transports, so HTTPS_PROXY/HTTP_PROXY were ignored.
this PR that adds a proxy field on the BigQuery source config and routes both the client and REST service through a proxy-aware HTTP client (explicit proxy or HTTP(S)_PROXY). Docs updated.

Example:
proxy: "https://proxy.company:8443"

fixes #2766

@Deeven-Seru
Deeven-Seru requested review from a team as code owners April 3, 2026 05:11

@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 support for an optional HTTP(S) proxy in the BigQuery source, allowing API calls to be routed through a proxy server. The changes include updates to the configuration struct, documentation, and the initialization logic for BigQuery clients and services. However, the current implementation is incomplete as the proxy configuration is not applied to Dataplex client initialization or service account impersonation calls, which may cause failures in restricted environments. Additionally, the documentation should be generalized to reflect that the proxy affects all outbound API calls from the source, not just BigQuery-specific ones.

Comment thread internal/sources/bigquery/bigquery.go
Comment thread internal/sources/bigquery/bigquery.go Outdated
Comment thread docs/en/integrations/bigquery/source.md Outdated
@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 support for an optional HTTP(S) proxy in the BigQuery source, allowing API calls to be routed through a proxy server. The changes include updates to the configuration schema, documentation, and the internal client initialization logic for both BigQuery and Dataplex. However, several critical issues were identified in the review: the current implementation creates a new http.Transport for every client request which can lead to resource exhaustion, the proxy configuration is currently ignored for gRPC-based operations (the default for these clients), and the casting of the default transport is brittle and could cause runtime failures if the transport is wrapped by other libraries.

Comment thread internal/sources/bigquery/bigquery.go Outdated
Comment thread internal/sources/bigquery/bigquery.go
Comment thread internal/sources/bigquery/bigquery.go
@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 support for HTTP(S) proxies in the BigQuery source. It adds a proxy configuration field, updates documentation, and refactors the internal connection logic to use proxy-aware HTTP clients for both BigQuery and Dataplex services. Feedback suggests using http.ProxyFromEnvironment for more robust proxy detection and injecting the proxy-aware client into the context via oauth2.HTTPClient to ensure authentication requests also honor the proxy settings.

Comment thread internal/sources/bigquery/bigquery.go
Comment thread internal/sources/bigquery/bigquery.go
Comment thread internal/sources/bigquery/bigquery.go
@Yuan325 Yuan325 removed their assignment Apr 9, 2026
@Yuan325 Yuan325 added the product: bigquery BigQuery label Apr 9, 2026
@shobsi
shobsi requested a review from Genesis929 April 9, 2026 19:21
@shobsi shobsi assigned Genesis929 and unassigned shobsi Apr 9, 2026
@Deeven-Seru
Deeven-Seru force-pushed the fix-2766-bq-proxy branch 2 times, most recently from a2d6191 to 865f60f Compare April 21, 2026 16:24
@Deeven-Seru

Copy link
Copy Markdown
Contributor Author

hi @Genesis929 do we have any update on this ?

@Genesis929 Genesis929 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.

LGTM, but we may better have related integration tests.

@Yuan325

Yuan325 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Hi @Deeven-Seru would you mind adding integration tests for this? Thank you

@Yuan325 Yuan325 added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Jun 22, 2026
@Deeven-Seru

Copy link
Copy Markdown
Contributor Author

done @Yuan325 I have added the integration test,a single test but I believe it covers the scope.

@Deeven-Seru
Deeven-Seru requested review from a team as code owners June 23, 2026 05:09
@Deeven-Seru
Deeven-Seru requested review from a team as code owners June 23, 2026 05:09
@shobsi

shobsi commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Hi @Deeven-Seru,

Thank you so much for the time and effort you put into this pull request, and for following up with the integration tests!

We've decided to move forward with an alternative approach proposed in PR #3437 to solve this routing issue. That PR introduces an apiEndpoint configuration, which allows us to use the SDK's native option.WithEndpoint() method. We prefer this approach because it avoids the need to manually construct a new http.Transport and hardcode network timeouts, making it less invasive and easier for us to maintain long-term.

Please let us know if #3437 would miss any scenario we are trying to address in this PR, or else we would like to close this PR.

We really appreciate your willingness to contribute and help improve the project!

@Deeven-Seru

Copy link
Copy Markdown
Contributor Author

Thanks for the review @shobsi , #3437 looks great :)

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. product: bigquery BigQuery

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Route BigQuery API calls through a proxy

4 participants