Skip to content

Commit

Permalink
docs: Update example to highlight I() for nested table identifier (#606)
Browse files Browse the repository at this point in the history
* docs: update example to highlight I() for nested table identifier

* test: add test for nested table identifier
  • Loading branch information
mcanouil authored Apr 17, 2024
1 parent 1056d8b commit 7a624ea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/dplyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' # set up for billing
#' con <- DBI::dbConnect(bigquery(), project = bq_test_project())
#'
#' shakespeare <- con %>% tbl("publicdata.samples.shakespeare")
#' shakespeare <- con %>% tbl(I("publicdata.samples.shakespeare"))
#' shakespeare
#' shakespeare %>%
#' group_by(word) %>%
Expand Down
2 changes: 1 addition & 1 deletion man/src_bigquery.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions tests/testthat/test-dplyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ test_that("can work with literal SQL", {
expect_true("fips_code" %in% dbplyr::op_vars(x))
})

test_that("can work with nested table identifier", {
con_us <- DBI::dbConnect(
bigquery(),
project = "bigquery-public-data",
billing = bq_test_project()
)

expect_s3_class(dplyr::collect(head(dplyr::tbl(con_us, I("utility_us.country_code_iso")))), "tbl_df")
expect_error(dplyr::collect(head(dplyr::tbl(con_us, "utility_us.country_code_iso"))), "tbl_df")
})

test_that("can copy_to", {
ds <- bq_test_dataset()
con <- DBI::dbConnect(ds)
Expand Down

0 comments on commit 7a624ea

Please sign in to comment.