Using the methods outlined in this readme doc, it's straight forward to query a single table, like so
library(bigrquery)
library(dplyr)
natality <- tbl(con, "natality")
natality %>%
select(year, month, day, weight_pounds) %>%
head(10) %>%
collect()
This allows us to write regular dplyr
code against natality
, and bigrquery
translates that dplyr
code into a BigQuery query.
But suppose the natality
table was instead 2 (or more) separate tables named natality1
, natality2
, and that they could be rbind
'd together.
How can I do this using BigQuery? That is, how can I query these separate tables as though they are all together as one table?
What I tried
I thought bind_rows
may work, but it doesn't.
library(bigrquery)
library(dplyr)
natality1 <- tbl(con, "natality1")
natality2 <- tbl(con, "natality2")
natality1 %>% bind_rows(., natality2) %>%
select(year, month, day, weight_pounds) %>%
head(10) %>%
collect()
Notes
- A scan of the docs didn't reveal anything obvious (but there maybe something).
- BigQuery supports wildcard for selecting/moving files. I'm not sure if that support extends into BigQuery and bigrquery