Siwawut Salikupt
Siwawut Salikupt

Reputation: 27

How can i connect snowflake with Oauth via python?

I need to connect from google. Example from snowflake is

ctx = snowflake.connector.connect(
    user="<username>",
    host="<hostname>",
    account="<account_identifier>",
    authenticator="oauth",
    token="<oauth_access_token>",
    warehouse="test_warehouse",
    database="test_db",
    schema="test_schema")

but how can i get <oauth_access_token> value? Please help

Upvotes: 3

Views: 5614

Answers (1)

Srinath Menon
Srinath Menon

Reputation: 1642

You need to generate the OAuth Token based on the OAuth security that you have set up. Whether it is a Snowflake OAuth or External OAuth is entirely based on your technical and business requirement. Details for it are here: https://docs.snowflake.com/en/user-guide/oauth-intro.html

There are some great KB's as well which gives exact set of steps for setting it up:

https://community.snowflake.com/s/article/Create-External-OAuth-Token-Using-Azure-AD-For-The-OAuth-Client-Itself

https://community.snowflake.com/s/article/External-oAuth-Token-Generation-using-Azure-AD

https://community.snowflake.com/s/article/How-To-Create-External-Oauth-Token-Using-Okta-For-The-Client-Itself-Service-Flow

Upvotes: 5

Related Questions