# NOT RUN {
if (bq_testable()) {
con <- DBI::dbConnect(
bigquery(),
project = "publicdata",
dataset = "samples",
billing = bq_test_project()
)
con
DBI::dbListTables(con)
DBI::dbReadTable(con, "natality", max_results =10)
# Create a temporary dataset to explore
ds <- bq_test_dataset()
con <- DBI::dbConnect(
bigquery(),
project = ds$project,
dataset = ds$dataset
)
DBI::dbWriteTable(con, "mtcars", mtcars)
DBI::dbReadTable(con, "mtcars")[1:6, ]
DBI::dbGetQuery(con, "SELECT count(*) FROM mtcars")
res <- DBI::dbSendQuery(con, "SELECT cyl, mpg FROM mtcars")
dbColumnInfo(res)
dbFetch(res, 10)
dbFetch(res, -1)
DBI::dbHasCompleted(res)
}
# }
Run the code above in your browser using DataLab