This repository was archived by the owner on Mar 31, 2026. It is now read-only.
add fromServiceAccountJsonInputStream#7
Open
vijaykramesh wants to merge 2 commits into
Open
Conversation
…rvice account json
Author
|
@seratch any thoughts? |
seratch
suggested changes
Oct 28, 2017
| ): BigQuery = { | ||
|
|
||
| val credential = using(new FileInputStream(serviceAccountJsonFilePath)) { in => | ||
| BigQuery.fromServiceAccountJsonInputStream(new FileInputStream(serviceAccountJsonFilePath), transport, jsonFactory, scopes) |
Owner
There was a problem hiding this comment.
the FileInputStream resource must be closed.
seratch
reviewed
Oct 28, 2017
| scopes: Seq[String] = Seq(BigqueryScopes.BIGQUERY) | ||
| ): BigQuery = { | ||
|
|
||
| val credential = using(serviceAccountJsonInputStream) { in => |
Owner
There was a problem hiding this comment.
Ah, the passed resource is closed here. I don't think it's a good approach. Closing a resource near its creation is easy to maintain.
…Stream is created
Author
|
hey @seratch I was on holiday and missed your comments. I switched things back a bit so the existing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
similar to the
BigQuery.fromServiceAccountJson(that expects a file path), this new method allows you to pass in anInputStream. We have a use-case where all configuration is happening via ENV vars, and I'd prefer to not have to write the config to the local (container) filesystem.I also added a test for both of the service account json methods I have added. Same as the existing test, it requires you change
yourOwnProjectIdand to have a file existing at$HOME/.bigquery/service_account.json: