snowflakedb / dplyr-snowflakedb

SnowflakeDB backend for dplyr
Apache License 2.0
65 stars 25 forks source link

error in evaluating the argument 'drv' in selecting a method for function 'dbConnect' #39

Closed armenic closed 3 years ago

armenic commented 3 years ago

dear developers and community.

I managed to install the package, created the snowflake account and tried connecting with no avail. This is my fully URL that I use in snowflake dashboard https://rq97283.us-east-2.aws.snowflakecomputing.com Below is the snippet I tried to run

library(dplyr)
library(dplyr.snowflakedb)
options(dplyr.jdbc.classpath = "/home/snowman/Downloads/snowflake_jdbc.jar")

my_db <- src_snowflakedb(
  user = Sys.getenv("USER"),
  password = Sys.getenv("PASSWORD"),
  account = "rq97283.us-east-2.aws",
  opts = list(
    warehouse = "ETL",
    db = "SNOWFLAKE_SAMPLE_DATA",
    schema = "WEATHER"
  )
)

Unfortunately it produces error like this:

host: 
URL: jdbc:snowflake://rq97283.us-east-2.aws.snowflakecomputing.com:443/?account=rq97283.us-east-2.aws&warehouse=ETL&db=SNOWFLAKE_SAMPLE_DATA&schema=WEATHER
Error in (function (cond)  : 
  error in evaluating the argument 'drv' in selecting a method for function 'dbConnect': java.lang.ClassNotFoundException

R.version

platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          0.3                         
year           2020                        
month          10                          
day            10                          
svn rev        79318                       
language       R                           
version.string R version 4.0.3 (2020-10-10)
nickname       Bunny-Wunnies Freak Out
packageVersion("dplyr.snowflakedb")
[1] ‘0.3.0’

Thank you so much for your help and time!

rdatasculptor commented 3 years ago

What if you use the host instead of account? Something like this (after removing the account parameter):

host = "rq97283.us-east-2.aws.snowflakecomputing.com"

armenic commented 3 years ago

@rdatasculptor, thank you so much for the suggestion. This is what happens:

my_db <- src_snowflakedb(
  user = Sys.getenv("USER"),
  password = Sys.getenv("PASSWORD"),
  host = "rq97283.us-east-2.aws.snowflakecomputing.com",
  opts = list(
    warehouse = "ETL",
    db = "SNOWFLAKE_SAMPLE_DATA",
    schema = "WEATHER"
  )
)
host: rq97283.us-east-2.aws.snowflakecomputing.com
URL: jdbc:snowflake://rq97283.us-east-2.aws.snowflakecomputing.com:443/?account=&warehouse=ETL&db=SNOWFLAKE_SAMPLE_DATA&schema=WEATHER
Error in (function (cond)  : 
  error in evaluating the argument 'drv' in selecting a method for function 'dbConnect': java.lang.ClassNotFoundException
armenic commented 3 years ago

silly me, the issue was a wrong path for snowflake-jdbc thanks to my colleague and friend Vitali Marenny 💯 @vmarenny

the following worked nicely:

library(dplyr)
library(dplyr.snowflakedb)
options(dplyr.jdbc.classpath = "snowflake-jdbc-3.12.9.jar")

my_db <- src_snowflakedb(
  user = Sys.getenv("USER"),
  password = Sys.getenv("PASSWORD"),
  account = "rq97283.us-east-2.aws",
  opts = list(
    warehouse = "ETL",
    db = "SNOWFLAKE_SAMPLE_DATA",
    schema = "WEATHER"
  )
)