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

Query worked in 1.4.4 but not in 2.0 #552

Closed
dcaud opened this issue Nov 30, 2020 · 3 comments
Closed

Query worked in 1.4.4 but not in 2.0 #552

dcaud opened this issue Nov 30, 2020 · 3 comments

Comments

@dcaud
Copy link

dcaud commented Nov 30, 2020

This used to work:

library(dbplyr)
library(dplyr.snowflakedb)

THEN I WOULD CONNECT via src_snowflakedb(my credentials)

test <- tbl(db, in_schema('S1.PUBLIC', 'S1_PROFILE_PROD')) 

But in 2.0 it gives me this error:

Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set",  : 
  Unable to retrieve JDBC result set
  JDBC ERROR: SQL compilation error:
Object '"S1.PUBLIC.S1_PROFILE_PROD"' does not exist or not authorized.
  Statement: SELECT * FROM "S1.PUBLIC.S1_PROFILE_PROD" AS "q08" LIMIT 0

If I downgrade to 1.4.4 the query above works. Can you help me figure out how to make this work in 2.0.0?

@awong234
Copy link

I think I have a similar case; I used to think that making a connection to a server without specifying a database (using dbConnect), and then specifying the database in in_schema like you have was efficient; tbl(db, in_schema('database.schema', 'table_name')).

With v2 there are two methods that work:

tbl(db, in_schema(dplyr::sql('database.schema'), 'table_name'))
# OR
tbl(db, DBI::Id(database = 'database', schema = 'schema', table = 'table))

This relates to the following change in the update notes:

in_schema() quotes each input individually (#287) (use sql() to opt out
of quoting, if needed). And DBI::Id() should work anywhere that
in_schema() does.

@dcaud
Copy link
Author

dcaud commented Nov 30, 2020

Thanks! I used your first method and it seemed to work.

@hadley hadley closed this as completed Jan 13, 2021
@carlinstarrs
Copy link

tbl(db, in_schema(dplyr::sql('database.schema'), 'table_name'))

This workaround no longer seems to work in version 2.4.0 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants