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

Allow setting of api_endpoint via environment variable like google-cloud-storage #1193

Closed
djnym opened this issue Mar 30, 2022 · 0 comments · Fixed by #1222
Closed

Allow setting of api_endpoint via environment variable like google-cloud-storage #1193

djnym opened this issue Mar 30, 2022 · 0 comments · Fixed by #1222
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@djnym
Copy link

djnym commented Mar 30, 2022

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Is your feature request related to a problem? Please describe.
I'd like a way to have a bigquery emulator running as a local docker container which I can use for local integration testing.

Describe the solution you'd like
I'm able to achieve something similar with GCS using https://github.com/oittaa/gcp-storage-emulator and setting the STORAGE_EMULATOR_HOST environment variable which is read during the storage Client constructor and used to set the api_endpoint in the client_info see here and here. I've found I can construct a BQ Client using something like bigquery.Client(client_options={"api_endpoint": "http://localhost:8080"}) and the calls will be redirected to that host/port. However, that requires changing code which creates clients. Whereas with the environment variable in storage I can redirect without changing code. I'd like this library to implement similar logic to check for the existence of a BIGQUERY_EMULATOR_HOST or some similar environment variable and use that to set the api_endpoint in the same way as the STORAGE_EMULATOR_HOST does so that I could then stub out a mock BigQuery emulator to use in testing.

Describe alternatives you've considered
As described above I've looked at changing any constructors in my code base to include the api_endpoint and that is an okay work around, but it seems like having a consistent way to specify an alternate via an environment variable would be better.

Additional context
Hopefully the links above are sufficient extra context.

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Mar 30, 2022
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Mar 31, 2022
@steffnay steffnay added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Apr 4, 2022
@steffnay steffnay self-assigned this Apr 4, 2022
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants