I’m having trouble connecting to Snowflake from R. Any suggestions?

7.55K viewsErrors and Troubleshooting
0

I’m having trouble connecting to Snowflake from R. Any suggestions?

Gisele Casillas Answered question December 30, 2021
0

If you want to connect to Snowflake from R (RStudio) you will need to use the ODBC (Open Database Connectivity) driver on either Windows, MacOS, or Linux.

Here are some steps on how to do this:

1. The first step is to create an ODBC DSN (Data Source Name)
2. Then you will test if the ODBC DSN is working
3. Lastly, the code that can be used on RStudio is:

install.packages(c(“DBI”, “dplyr”,”dbplyr”,”odbc”))
library(DBI)
library(dplyr)
library(dbplyr)
library(odbc)
myconn <- DBI::dbConnect(odbc::odbc(), "SNOWFLAKE_DSN_NAME", uid="USERNAME", pwd='Snowflak123')
mydata <- DBI::dbGetQuery(myconn,"SELECT * FROM EMP")
head(mydata)

Gisele Casillas Answered question December 30, 2021