Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't join across sources #219

Closed
hadley opened this issue Apr 3, 2018 · 2 comments

Comments

@hadley
Copy link
Member

commented Apr 3, 2018

library(dplyr, warn.conflicts = FALSE)
library(bigrquery)

con1 <- DBI::dbConnect(
  bigrquery::dbi_driver(),
  dataset = "noaa_gsod",
  project = "bigquery-public-data",
  billing = "887175176791"
)
con2 <- DBI::dbConnect(
  bigrquery::dbi_driver(),
  dataset = "samples",
  project = "bigquery-public-data",
  billing = "887175176791"
)
tbl1 <- tbl(con1, "gsod2008")
tbl2 <- tbl(con2, "gsod")

left_join(tbl1, tbl2, by = c("year" = "year", "mo" = "month", "da" = "day"))
#>  Error: `x` and `y` must share the same src, set `copy` = TRUE (may be slow) 
left_join(tbl2, tbl1, by = c("year" = "year", "month" = "mo", "day" = "da"))
#>  Error: `x` and `y` must share the same src, set `copy` = TRUE (may be slow) 

(Part of #101)

@hadley

This comment has been minimized.

Copy link
Member Author

commented Apr 12, 2018

Need to adjust same_src() so it's always true for any two bigquery connections. Then ensure we always use the fully qualified table name.

Possibly related: tidyverse/dplyr#2993

@hadley

This comment has been minimized.

Copy link
Member Author

commented Apr 17, 2018

Better approach, which works in dev version.

library(dplyr, warn.conflicts = FALSE)
library(bigrquery)

con <- DBI::dbConnect(bigrquery::dbi_driver(), project = bq_test_project())
tbl1 <- tbl(con, "bigquery-public-data.noaa_gsod.gsod2008")
tbl2 <- tbl(con, "bigquery-public-data.samples.gsod")

left_join(tbl1, tbl2, by = c("year" = "year", "mo" = "month", "da" = "day"))
left_join(tbl2, tbl1, by = c("year" = "year", "month" = "mo", "day" = "da"))

@hadley hadley closed this in e878568 Apr 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.