从Snowflake导入数据,单点登录到R

时间:2017-05-09 14:31:45

标签: r snowflake-datawarehouse

我可以直接从Snowflake数据库导入数据到R吗?我能够通过使用我的Snowflake凭据创建ODBC连接来完成此操作;然而,我的公司将Snowflake改为单点登录,我无法让它工作。

2 个答案:

答案 0 :(得分:0)

我们支持ODBC的OKTA单点登录。请按照https://docs.snowflake.net/manuals/user-guide/odbc-parameters.html了解配置ODBC DSN的步骤。

答案 1 :(得分:0)

您当然可以使用R连接到Snowflake,我强烈建议您使用RJDBC库。安装RJDBC库和下载snowflake’s jar file有两个要求。 (不用说,请确保jar文件在驱动器上的某个地方是安全的,不能被意外删除或移动)。您可以选择一个jar文件版本,例如3.6.6

# load library
library(RJDBC)

# specify driver
jdbcDriver <- JDBC(driverClass="net.snowflake.client.jdbc.SnowflakeDriver", 
                classPath="/home/username/R/snowflake-jdbc-3.6.6.jar") # <-- this is where I saved the jar file

# create a connection
# this is the most critical part.
# you have to make sure you enter your SSO path as well as corp username with domain
con <- dbConnect(jdbcDriver, "jdbc:snowflake://company.us-east-1.snowflakecomputing.com/?authenticator=https://your_domain_name.okta.com/", 
                        'username@domain.com', 'password')

# to query data
# at this point, you are good to go. start querying data.
dbGetQuery(con, "select current_timestamp() as now")