Skip to content

Allow overriding of API host (base_url) #648

@graup

Description

@graup

Currently, base_url is hardcoded to https://bigquery.googleapis.com/bigquery/v2/.

However, there are certain scenarios where someone would want to override the host, e.g. for testing with a local emulator or other proxy services.

Pretty much every official bigquery SDK (e.g. Python, NodeJS, Ruby etc.) exposes a BIGQUERY_EMULATOR_HOST env variable for this purpose.

I guess the change would be as simple as

- base_url <- "https://bigquery.googleapis.com/bigquery/v2/"
- upload_url <- "https://bigquery.googleapis.com/upload/bigquery/v2/"
+ host <- Sys.getenv("BIGQUERY_EMULATOR_HOST", unset = "https://bigquery.googleapis.com")
+ base_url <- paste0(host, "/bigquery/v2/")
+ upload_url <- paste0(host, "/upload/bigquery/v2/")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions