Skip to content

Commit

Permalink
Merge pull request #405 from lethanhduong/fix/fix-logic-to-get-connec…
Browse files Browse the repository at this point in the history
…tion-to-bigquery

fix(bigquery-connection): Fix chain authen logic when we try to create bigquery client
  • Loading branch information
zainhoda authored May 6, 2024
2 parents 4d58c97 + ddd4b0c commit c23620a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/vanna/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,19 +1146,14 @@ def connect_to_bigquery(self, cred_file_path: str = None, project_id: str = None

conn = None

try:
conn = bigquery.Client(project=project_id)
except:
print("Could not found any google cloud implicit credentials")

if cred_file_path:
if not cred_file_path:
try:
conn = bigquery.Client(project=project_id)
except:
print("Could not found any google cloud implicit credentials")
else:
# Validate file path and pemissions
validate_config_path(cred_file_path)
else:
if not conn:
raise ValidationError(
"Pleae provide a service account credentials json file"
)

if not conn:
with open(cred_file_path, "r") as f:
Expand Down

0 comments on commit c23620a

Please sign in to comment.