Error using tbl() with snowflake connection #4436
Replies: 7 comments 1 reply
-
This looks related to #3893 where someone else saw:
We don't have a great answer for why that person's problems were resolved unfortunately. Can you share what version of Positron you are running? I expect that you can run this just fine? library(DBI)
library(duckdb)
library(dbplyr)
library(dplyr)
con <- dbConnect(duckdb::duckdb())
dbWriteTable(con, "cars", mtcars)
tbl(con, "cars") Can you share the output for |
Beta Was this translation helpful? Give feedback.
-
Thanks for the additional information and calling out that you can render notebooks without issue! Those are both super helpful. Your driver and DB versions are all quite recent so that doesn't seem like an issue. I'm unfortunately not able to replicate on Positron 2024.08.0 (system setup) build 48, Windows 11 Pro quite yet. Could you share your odbc, dplyr, and dbplyr package versions? Also, could you try with both the current CRAN odbc (i.e. with Also, could you share the output of the following R code 1) from RStudio, 2) from Positron, and 3) From within an Sys.getenv("PATH") Note to future self--this is the code I used to connect and test: library(odbc)
library(dplyr)
library(dbplyr)
con <- dbConnect(snowflake(), authenticator = "externalbrowser", UID = "my_email")
dbExecute(con, "USE WAREHOUSE DEFAULT_WH")
tbl(con, in_catalog("SNOWFLAKE", "INFORMATION_SCHEMA", "APPLICABLE_ROLES")) |
Beta Was this translation helpful? Give feedback.
-
Hi Simon,
Below are the current package versions requested
odbc 1.5.0
dplyr 1.1.4
dbplyr 2.5.0
I tried with the current odbc package as well as updating to the DEV version noted and the results were the same.
Sys.getenv("PATH") ouput
From RStudio
"C:\\rtools44\\x86_64-w64-mingw32.static.posix\\bin;C:\\rtools44\\usr\\bin;C:\\Users\\philden\\AppData\\Local\\Programs\\R\\R-4.4.0\\bin\\x64;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Positron\\bin;C:\\Users\\philden\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\philden\\AppData\\Local\\GitHubDesktop\\bin;C:\\Program Files\\RStudio\\resources\\app\\bin\\quarto\\bin;C:\\Program Files\\RStudio\\resources\\app\\bin\\postback"
From Positron
"C:\\rtools44/x86_64-w64-mingw32.static.posix/bin;C:\\rtools44/usr/bin;;c:\\Program Files\\Positron\\resources\\app\\quarto\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Positron\\bin;C:\\Users\\philden\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\philden\\AppData\\Local\\GitHubDesktop\\bin"
From html_notebook output
"C:\\rtools44/x86_64-w64-mingw32.static.posix/bin;C:\\rtools44/usr/bin;;c:\\Program Files\\Positron\\resources\\app\\quarto\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Positron\\bin;C:\\Users\\philden\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\philden\\AppData\\Local\\GitHubDesktop\\bin"
Best,
Pat
…________________________________
From: Simon P. Couch ***@***.***>
Sent: Friday, August 23, 2024 11:43 AM
To: posit-dev/positron ***@***.***>
Cc: Pat Hilden ***@***.***>; Author ***@***.***>
Subject: Re: [posit-dev/positron] Error using tbl() with snowflake connection (Discussion #4436)
CAUTION: Originated from outside RP
Thanks for the additional information and calling out that you can render notebooks without issue! Those are both super helpful. Your driver and DB versions are all quite recent so that doesn't seem like an issue. I'm unfortunately not able to replicate on Positron 2024.08.0 (system setup) build 48, Windows 11 Pro quite yet.
Could you share your odbc, dplyr, and dbplyr package versions? Also, could you try with both the current CRAN odbc (i.e. with pak::pak("odbc") and then restarting R) and current dev (pak::pak("r-dbi/odbc") and restarting R)?
Also, could you share the output of the following R code 1) from RStudio, 2) from Positron, and 3) From within an html_notebook rendered with Positron?
Sys.getenv("PATH")
Note to future self--this is the code I used to connect and test:
library(odbc)
library(dplyr)
library(dbplyr)
con <- dbConnect(snowflake(), authenticator = "externalbrowser", UID = "my_email")
dbExecute(con, "USE WAREHOUSE DEFAULT_WH")
tbl(con, in_catalog("SNOWFLAKE", "INFORMATION_SCHEMA", "APPLICABLE_ROLES"))
—
Reply to this email directly, view it on GitHub<#4436 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BALAFNGG5Q35Y2N72MUF6OLZS5KBTAVCNFSM6AAAAABM42L4R2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBTGIZDENY>.
You are receiving this because you authored the thread.
RPM-Disclaimer: This email may contain confidential information and is solely for use by the intended recipient(s). Any use, copying or dissemination by any other person is strictly prohibited. If you are not an intended recipient, please notify the sender immediately and delete all copies of the email.
|
Beta Was this translation helpful? Give feedback.
-
Looks like Could you supply the code snippet you're using to connect? All is well if you scrub out usernames/passwords/etc. Only one more hypothesis I can think of: I don't know how Positron's connections contract is implemented but perhaps RStudio's attaches a namespace somewhere where Positron doesn't. Have you explicitly loaded each of DBI, odbc, dplyr, and dbplyr (rather than using e.g. |
Beta Was this translation helpful? Give feedback.
-
Hi Simon,
I was able to resolve the issue by explicitly loading the odbc package.
Previously, my connection was done by
con <- dbConnect(
odbc::odbc(),
....
)
as that was the only time I was calling the odbc package.
When I replace the above with
library(odbc)
con <- dbConnect(
odbc(),
...
)
Everything works without issue and I no longer have the error with the tbl() function.
All best,
Pat
…________________________________
From: Simon P. Couch ***@***.***>
Sent: Monday, August 26, 2024 11:26 AM
To: posit-dev/positron ***@***.***>
Cc: Pat Hilden ***@***.***>; Author ***@***.***>
Subject: Re: [posit-dev/positron] Error using tbl() with snowflake connection (Discussion #4436)
CAUTION: Originated from outside RP
Looks like PATHs are not the issue.
Could you supply the code snippet you're using to connect? All is well if you scrub out usernames/passwords/etc.
Only one more hypothesis I can think of: I don't know how Positron's connections contract is implemented but perhaps RStudio's attaches a namespace somewhere where Positron doesn't. Have you explicitly loaded each of DBI, odbc, dplyr, and dbplyr (rather than using e.g. dplyr::tbl()? Are results the same when you load them all and don't namespace vs. load none and refer to them all by their namespace?
—
Reply to this email directly, view it on GitHub<#4436 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BALAFNCDSL3N5ZHQQ224VXDZTNCJHAVCNFSM6AAAAABM42L4R2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBVGMZTCMQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
RPM-Disclaimer: This email may contain confidential information and is solely for use by the intended recipient(s). Any use, copying or dissemination by any other person is strictly prohibited. If you are not an intended recipient, please notify the sender immediately and delete all copies of the email.
|
Beta Was this translation helpful? Give feedback.
-
Awesome, thanks for confirming! |
Beta Was this translation helpful? Give feedback.
-
We're going to keep an eye on this moving forward, as we've now had two people run into problems connecting to databases with S3 method errors like:
I am particularly suspicious that something may be wrong in Positron because @PHilden-RP said his code without the explicit Thank you again for the report! |
Beta Was this translation helpful? Give feedback.
-
I can successfully make a connection to my snowflake database, but the
tbl()
function does not appear to work on this, I get the following error messageno applicable method for 'tbl' applied to an object of class "Snowflake"
The same code works just fine in RStudio.
Overall loving Positron, thanks for your work!
Beta Was this translation helpful? Give feedback.
All reactions