Running job '...
Error: Job '...' failed
x Type not found: FLOAT at [2:9] [invalidQuery]
Run `rlang::last_error()` to see where the error occurred.
In addition: Warning message:
In class(obj) <- c("scalar", class(obj)) :
Setting class(x) to multiple strings ("scalar", "SQL", ...); result will no longer be an S4 object
Could you run sessioninfo::session_info() and respond with the results here? This will help determine if there are outdated packages or other factors that may be influencing the observed error.
I updated the packages and still doesn't work. I tried really simple example:
t <- tibble::tibble(
x = 1:10,
y = letters[1:10]
)
dbCreateTable(con, "mtcars", mtcars)
I also checked query history in BQ:
CREATE TABLE `t` (
`x` INTEGER,
`y` STRING
)
And it seems when creating table R types are used (INTEGER is not available in BQ).
When creating mtcars all fields were FLOAT which also doesn't exist in BQ.
Hmm interesting. Can you post a reprex, including output, of the following:
library(bigrquery)
con <- dbConnect(
bigquery(),
project = "bigrquery-test-277617",
dataset = "cars"
)
dbWriteTable(con,
"foo",
tibble::tibble(
x = 1:10,
y = letters[1:10]
))
dbReadTable(con, "foo")
#> # A tibble: 10 x 2
#> y x
#> <chr> <int>
#> 1 a 1
#> 2 b 2
#> 3 c 3
#> 4 d 4
#> 5 e 5
#> 6 f 6
#> 7 g 7
#> 8 h 8
#> 9 i 9
#> 10 j 10
dbRemoveTable(con, "foo")
dbDisconnect(con)
It works! Also the previous examples! No idea what changed....
library(DBI)
library(bigrquery)
con <- dbConnect(
bigquery(),
project = "mihagazvoda-playground",
dataset = "test",
billing = "mihagazvoda-playground"
)
dbWriteTable(con,
"foo",
tibble::tibble(
x = 1:10,
y = letters[1:10]
))
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The bigrquery package is using a cached token for xxx@gmail.com.
dbReadTable(con, "foo")
#> # A tibble: 10 x 2
#> y x
#> <chr> <int>
#> 1 a 1
#> 2 b 2
#> 3 c 3
#> 4 d 4
#> 5 e 5
#> 6 f 6
#> 7 g 7
#> 8 h 8
#> 9 i 9
#> 10 j 10
dbRemoveTable(con, "foo")
dbDisconnect(con)
@mihagazvoda how interesting! I'm not sure what could have changed If you discover what enabled the expected behavior, update here so that others can benefit from the resolution