BigQueryCache: connect without service account #129
-
Hello, I'm trying to use SCOPES = ['https://www.googleapis.com/auth/bigquery']
credentials, project = google.auth.default(scopes=SCOPES)
print(credentials)
# {"refresh_token": "XXX", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "YYY", "client_secret": "ZZZZ", "universe_domain": "googleapis.com", "account": "", "expiry": "2024-03-14T14:33:18.294693Z"}
with tempfile.NamedTemporaryFile(mode="w", delete=False) as temp:
temp.write(credentials.to_json())
temp.flush()
temp.close()
bq_cache = BigQueryCache(project_name=project, credentials_path=temp.name)
source.select_all_streams()
read_result: ab.ReadResult = source.read(cache=bq_cache) The structure of the credential is not good, I get this error:
Usually, when I'm using BigQuery I don't use credential file. from google.cloud import bigquery
cli = bigquery.Client() Thanks for your work. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@4sushi - Thanks for trying out PyAirbyte and thanks for leaving this feedback. I have briefly looked into what would be required to use the Google CLI Client instead of a service account credentials file. The place that most likely would need to be updated is PyAirbyte/airbyte/_processors/sql/bigquery.py Lines 141 to 149 in 86722f4 We may also need to update And we might want to modify the Let us know if this is something you are interested in contributing to. Otherwise, we will add to the project board for prioritization. |
Beta Was this translation helpful? Give feedback.
-
Circling back here for future readers. This feature has been released! Thanks again to @4sushi for contributing. 🙏🎉 |
Beta Was this translation helpful? Give feedback.
@4sushi - Thanks for trying out PyAirbyte and thanks for leaving this feedback. I have briefly looked into what would be required to use the Google CLI Client instead of a service account credentials file.
The place that most likely would need to be updated is
_get_credentials()
, which currently expects to initialize auth for a service account:PyAirbyte/airbyte/_processors/sql/bigquery.py
Lines 141 to 149 in 86722f4