bigrquery
bigrquery copied to clipboard
Allow overriding of API host (base_url)
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/")