There is a great R package "bigrquery". I can run the code below in RStudio and from the console. But it gives me an error "Can't get Google credentials" when I try to run it via "crontab".
Here is the code:
# 1. Library
library(bigrquery)
# 2. Credentials
BQ_AUTH_PATH <- "file_name.json"
BQ_PROJECT_ID <- "project_id"
# 3. Auth to BQ via 'json' credentials
bq_auth(path = BQ_AUTH_PATH)
# 4. Define 'project_id'
project_id <- BQ_PROJECT_ID
# 5. Define SQL queries
sql <- "SELECT * FROM `data_table`"
# 5. Load data
query_exec(sql, project_id, use_legacy_sql = FALSE)
Please, advise on how to fix this issue.
Thanks