通过 R/RJDBC 的雪花 - 无法检索 JDBC 结果集

Snowflake through R/RJDBC - Unable to retrieve JDBC result set

我安装了最新的 Java,使用 Windows 命令提示符

检查
java --version

C:\Users\sweepydodo>java --version
java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

我有运行以下

library(RJDBC)

drv <- JDBC(driverClass = "net.snowflake.client.jdbc.SnowflakeDriver"
            , classPath = "C:/Users/sweepydodo/Documents/R/snowflake-jdbc-3.13.9.jar"
            , identifier.quote = "`"
            )

con <- dbConnect(drv, "jdbc:snowflake://gs46004.eu-west-1.snowflakecomputing.com:443?warehouse=prd_wh&ROLE=prod_readonly&authenticator=externalbrowser&database=dwh_db", "sweepydodo@abc.com", "dummy password")

R 控制台然后读取

Nov 17, 2021 3:37:01 PM net.snowflake.client.core.CredentialManager fillCachedCredential
INFO: JNA jar files are needed for Secure Local Storage service. Please follow the Snowflake JDBC instruction for Secure Local Storage feature. Fall back to normal process.
Initiating login request with your identity provider. A browser window should have opened for you to complete the login. If you can't see it, check existing browser windows, or your OS settings. Press CTRL+C to abort and try again...

然后它会打开一个浏览器 window,背景为白色,一行内容为:

Your identity was confirmed and propagated to Snowflake JDBC driver. You can close this window now and go back where you started from.

然后我回到 R 并且 运行

dbListTables(con)                 # list all tables

一切顺利,我收到了 table 的列表。当我 运行 一个实际查询时,我的问题就来了:

dbGetQuery(con,
           "
           select  *
           from    FACT_VISIT
           limit   10
           "
           )

读取错误

Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set",  : 
  Unable to retrieve JDBC result set
  JDBC ERROR: SQL compilation error:
Object 'FACT_VISIT' does not exist or not authorized.
  Statement: 
                select  *
                from    FACT_VISIT
                limit   10

我发现它 st运行ge 我可以使用 dbListTables(con) 查看 table 的列表,但无法查询任何 table。我期待任何 idea/solutions.

经过一天的搜索和同事的帮助,我们发现罪魁祸首是 Java 的最新版本 jdk-17_windows-x64_bin 和 Snowflake 的最新版本之一 3.13.9

有效的是原始 post 中描述的所有内容,但使用 here and snowflake-jdbc-3.10.3.jar from here 11.0.12 来自 here and snowflake-jdbc-3.10.3.jar from here.

来自 Java 的最新版本和 Snowflake 的 .jar 一起将为您带来概述的问题 here

最后,正如@Sergiu 指出的那样。在 SQL 查询中,我还应该明确指定数据库和方案名称。

dbGetQuery(con,
           "
           select  *
           from    dwh_db.visitor.fact_visit
           limit   10
           "
           )