Skip to content

Using odbc::snowflake() with authenticator = "SNOWFLAKE_JWT" #889

@daniepi

Description

@daniepi

Hi,
I am trying to connect to Snowflake using the new drv = odbc::snowflake(). It seems to expect both uid and pwd to be supplied at the same time. But what if I want to connect using authenticator = "SNOWFLAKE_JWT" and use priv_key_file and priv_key_file_pwd instead of uid and pwd? It still requires UID argument

conn <- DBI::dbConnect(
  drv = odbc::snowflake(),
  account = "account",
  authenticator = "SNOWFLAKE_JWT",
  priv_key_file = ".../rsa_key.p8",
  priv_key_file_pwd = "pass"
)

gives

Error in `DBI::dbConnect()`:
! ODBC failed with error 00000 from [Snowflake][DSI].
✖  (20032) Required setting 'UID' is not present in the connection settings.
ℹ From nanodbc/nanodbc.cpp:1150.

When I try

conn <- DBI::dbConnect(
  drv = odbc::snowflake(),
  account = "account",
  authenticator = "SNOWFLAKE_JWT",
  uid = "user"
  priv_key_file = ".../rsa_key.p8",
  priv_key_file_pwd = "pass"
)

it throws

Error in `DBI::dbConnect()`:
! Both `uid` and `pwd` must be specified to authenticate.
ℹ Or leave both unset to use ambient Snowflake credentials.

While

conn <- DBI::dbConnect(
  drv = odbc::snowflake(),
  account = "account",
  authenticator = "SNOWFLAKE_JWT",
  UID = "user"
  priv_key_file = ".../rsa_key.p8",
  priv_key_file_pwd = "pass"
)

just hangs.

Is there a way to use odbc::snowflake() with SNOWFLAKE_JWT? Or should I just continue using drv = odbc::odbc() instead? Thanks for help. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions