Skip to content
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

Path to client_secrets.json cannot be specified via config.json #22

Open
kgpayne opened this issue Feb 3, 2022 · 3 comments
Open

Path to client_secrets.json cannot be specified via config.json #22

kgpayne opened this issue Feb 3, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@kgpayne
Copy link

kgpayne commented Feb 3, 2022

By convention:

The config file contains whatever parameters the Tap needs in order to pull data from the source. Typically this will include the credentials for the API or data source.

Reliance on a required GOOGLE_APPLICATION_CREDENTIALS env var makes this tap an exception, complicating integration with singer-runner tooling.

@kgpayne
Copy link
Author

kgpayne commented Feb 3, 2022

Looks like the way to load google service account credentials from a specified file is the google-auth package:

from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file(
    '/path/to/key.json')

scoped_credentials = credentials.with_scopes(
    ['https://www.googleapis.com/auth/cloud-platform'])

Ideally, to be backwards compatible, we could add a new optional credentials_path config field allowing users to specify a config file location. If none is provided, the tap would fall back on the env var via .default():

import google.auth

credentials, project = google.auth.default()

I don't mind making this change and submitting a PR 👍

@kgpayne
Copy link
Author

kgpayne commented Feb 3, 2022

Credentials can be passed directly to the Client as an argument:

from google.cloud import bigquery
from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file('/path/to/key.json')
client = bigquery.Client(credentials=credentials)

@daigotanaka daigotanaka added the enhancement New feature or request label Feb 3, 2022
@daigotanaka daigotanaka added this to the v0.3.6 milestone Feb 3, 2022
@daigotanaka
Copy link
Collaborator

@kgpayne Thanks for bringing it up :)
I would appreciate if you can help me by creating a PR.
I very much prefer maintaining the backward compatibility. Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants