-
Notifications
You must be signed in to change notification settings - Fork 24
feat: Add support for quota project #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add support for quota project #225
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
44fd5e8 to
239071e
Compare
jayehwhyehentee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for raising this PR @nickcaballero. I have left a few minor comments. Can you share results from any actual invocation of this new functionality that demonstrates that it works as expected?
| if (credentials instanceof QuotaProjectIdProvider) { | ||
| return ((QuotaProjectIdProvider) credentials).getQuotaProjectId(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? Credentials are passed to the BQ client, and if they contain quota project, then doesn't the BQ client acknowledge them?
| .setCredentialsProvider( | ||
| FixedCredentialsProvider.create(options.getCredentials())) | ||
| .setCredentialsProvider(FixedCredentialsProvider.create(credentials)) | ||
| .setQuotaProjectId(quotaProjectId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity, please set quotaProjectId only if it is not null
| Credentials credentials = options.getCredentials(); | ||
| quotaProjectId = BigQueryUtils.getQuotaProjectId(options, credentials); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These variables should only be used once, so no value in storing them. Please revert to in-place retrievals.
| Credentials credentials = options.getCredentials(); | ||
| String quotaProjectId = BigQueryUtils.getQuotaProjectId(options, credentials); | ||
| BigQueryWriteSettings.Builder settingsBuilder = | ||
| BigQueryWriteSettings.newBuilder() | ||
| .setCredentialsProvider( | ||
| FixedCredentialsProvider.create(options.getCredentials())) | ||
| .setCredentialsProvider(FixedCredentialsProvider.create(credentials)) | ||
| .setQuotaProjectId(quotaProjectId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comments
| Credentials credentials = options.getCredentials(); | ||
| String quotaProjectId = BigQueryUtils.getQuotaProjectId(options, credentials); | ||
| bigQuery = | ||
| BigQueryOptions.newBuilder() | ||
| .setCredentials(options.getCredentials()) | ||
| .setCredentials(credentials) | ||
| .setQuotaProjectId(quotaProjectId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comments
This PR adds support for setting the quota project used when connecting to BigQuery. By default, the project where the dataset lives is used, but some teams use quota projects to separate resources from billing.