Open elalbaicin opened 3 months ago
Could you please rework your reproducible example to use the reprex package ? That makes it easier to see both the input and the output, formatted in such a way that I can easily re-run in a local session. Thanks!
Yes, of course.
library(bigrquery)
# Auth
bq_auth_configure(path = "client_key_googlecloud.json")
bq_auth(path = "marine-booth-200313-xxxxxxxxxxx.json")
# Project ID
projectId <- "marine-booth-200313"
# Download one row table
queryData1 <- "SELECT date FROM RData.adsRaw LIMIT 1"
bq_project_query(x = projectId, query = queryData1) |>
bq_table_download()
#> # A tibble: 1 × 1
#> date
#> <date>
#> 1 2020-12-22
# Download zero rows table (error)
queryData0 <- "SELECT date FROM RData.adsRaw LIMIT 0"
bq_project_query(x = projectId, query = queryData0) |>
bq_table_download()
#> # A tibble: 0 × 1
#> # ℹ 1 variable: date <chr>
Created on 2024-06-11 with reprex v2.1.0
Thanks! It'll probably be a couple of weeks before I get to this, but I'm hoping to put some more time into bigrquery soon.
Whenever a query result has zero rows, some columns of the downloaded data frame have their data type changed.
In particular, the downloaded data frame converts date columns to string columns:
This type conversion has caused some unexpected behavior. Is it possible to ensure that the column types from downloaded data frames always match the schema?