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

DBI: cannot run query without specifying dataset #240

Closed
czeildi opened this Issue Apr 23, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@czeildi

czeildi commented Apr 23, 2018

I get an error if I do not specify dataset in the second case:

library(DBI)
library(bigrquery)

billing <- bq_test_project() # replace this with your project ID 
sql <- "SELECT year, month, day, weight_pounds FROM `publicdata.samples.natality`"

con <- dbConnect(
    bigrquery::bigquery(),
    project = "publicdata",
    dataset = "samples",
    billing = billing
)
dbGetQuery(con, sql, n = 10)
dbDisconnect(con)

con <- dbConnect(
    bigrquery::bigquery(),
    project = "publicdata",
    billing = billing
)
dbGetQuery(con, sql, n = 10)
# Error: dataset is not a string (a length one character vector).
dbDisconnect(con)

I used my own billing project, otherwise ran the same code.

sorry for no reprex, it somehow ran for a lot of time without returning

@czeildi

This comment has been minimized.

czeildi commented Apr 23, 2018

related: project is a required argument and you must provide a valid project id (although it can be different from both billing and any project actually used in your sql queries later)

as you can run a query using tables from different projects in Google Big Query I do not see the need for this argument to be required

@hadley

This comment has been minimized.

Member

hadley commented Apr 23, 2018

Looks like I missed this case in my tests; dataset is definitely supposed to be optional.

@czeildi

This comment has been minimized.

czeildi commented Apr 23, 2018

Regarding my previous comment on needing project:

I can see now that billing is optional: so it is enough to populate project with billing project and than there's technically no superfluous information. However, if possible I would still prefer the more explicit version: specify the billing explicitly (this is unique) and the project should receive the billing as default value and can be specified otherwise by user

@hadley

This comment has been minimized.

Member

hadley commented Apr 23, 2018

I agree that would be optimal, but I think it would be too much of a change to an existing function.

@hadley hadley closed this in 7be9542 Apr 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment