fix(outputs.bigquery): Add scope to bigquery and remove timeout context (#14958)

This commit is contained in:
Tushar Gupta 2024-03-12 06:02:00 -07:00 committed by GitHub
parent 28aacdf59b
commit f7237170b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -88,14 +88,14 @@ func (s *BigQuery) Connect() error {
func (s *BigQuery) setUpDefaultClient() error {
var credentialsOption option.ClientOption
// https://cloud.google.com/go/docs/reference/cloud.google.com/go/0.94.1#hdr-Timeouts_and_Cancellation
// Do not attempt to add timeout to this context for the bigquery client.
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, time.Duration(s.Timeout))
defer cancel()
if s.CredentialsFile != "" {
credentialsOption = option.WithCredentialsFile(s.CredentialsFile)
} else {
creds, err := google.FindDefaultCredentials(ctx)
creds, err := google.FindDefaultCredentials(ctx, bigquery.Scope)
if err != nil {
return fmt.Errorf(
"unable to find Google Cloud Platform Application Default Credentials: %w. "+