-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snowflake JDBC - guidance to help add support #152
Comments
What config did you use to get connected to Snowflake? I've been trying, but getting a timeout. |
I have these two connections defined in my init file. I replaced some of the sensitive info, but the first is an example using the browser for authentication to support our SAML federation setup with Snowflake. The second example is for a training class using username and password.
(ejc-create-connection
"ideas_snowflake"
:dependencies [[net.snowflake/snowflake-jdbc "3.13.4"] [net.java.dev.jna/jna "5.8.0"]]
:classpath (concat "~/.m2/repository/net/snowflake/client/jdbc"
"/SnowflakeDriver/snowflake-jdbc-3.13.4.jar")
:connection-uri (concat "jdbc:snowflake://our_server.snowflakecomputing.com:443/?"
“user=my_email_login&"
"db=IAM_IDEAS&"
"warehouse=IAM_ETL_WH_XS&"
"schema=IAM_CRPROFILE&authenticator=externalbrowser"))
(ejc-create-connection
"class_snowflake"
:dependencies [[net.snowflake/snowflake-jdbc "3.13.4"] [net.java.dev.jna/jna "5.8.0"]]
:classpath (concat "~/.m2/repository/net/snowflake/client/jdbc"
"/SnowflakeDriver/snowflake-jdbc-3.13.4.jar")
:connection-uri (concat "jdbc:snowflake://aqa11592.snowflakecomputing.com:443/?"
"user=woodchuck&"
“password=Password%20WithAspace&"
"db=woodchuck_db&"
"warehouse=woodchuck_query_wh&"
"schema=public"))
… On Aug 22, 2021, at 1:55 PM, Daniel Benedict ***@***.***> wrote:
What config did you use to get connected to Snowflake? I've been trying, but getting a timeout.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#152 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AIHE6ASYBNJRSUVTBTZNLN3T6FP35ANCNFSM43O7HKOA>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>.
|
Just to document another example, here's the config that ended up working for me: (ejc-create-connection
"snowflake"
:dependencies [[net.snowflake/snowflake-jdbc "3.13.27"]
[net.java.dev.jna/jna "5.13.0"]]
:connection-uri (concat "jdbc:snowflake://my-db.snowflakecomputing.com:443"
"?user="my-email@myjob.com"
"&warehouse=my-warehouse"
"&role=my-role"
"&db=my-db"
"&authenticator=externalbrowser"
"&JDBC_QUERY_RESULT_FORMAT=JSON")) The The
I'm able to execute SQL queries and a couple of the interactive ejc commands, like The setup isn't perfect yet, as I'm getting an error running
|
@mbarton98, @cfclrk, I've added Snowflake connection example to README, from the example you provided. Here is an example for Oracle database: https://github.com/kostafey/ejc-sql/blob/master/src/ejc_sql/structure.clj#L119 |
I've managed to use this information to connect to snowflake. However every time I execute a query, it is doing the externalbrowser authentication - is a new connection being established for every query? (I would expect that the connection would be kept open, so the authentication would only happen when making making the initial |
This is what I used to configure connection caching with JDBC.
https://docs.snowflake.com/en/user-guide/admin-security-fed-auth-use#label-browser-based-sso-connection-caching
… On May 2, 2023, at 6:40 PM, Len Trigg ***@***.***> wrote:
I've managed to use this information to connect to snowflake. However every time I execute a query, it is doing the externalbrowser authentication - is a new connection being established for every query? (I would expect that the connection would be kept open, so the authentication would only happen when making making the initial ejc-connect)
—
Reply to this email directly, view it on GitHub <#152 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AIHE6AV63JFWQJFNQO37T33XEGZQ3ANCNFSM43O7HKOA>.
You are receiving this because you were mentioned.
|
I got our admin to enable that, but it turns out that credential caching is not supported on linux so I'm out of luck. Which leaves my other question of why the connection isn't kept open, removing the need to re-connect for every query. |
This was the only Emacs solution that I found that works with Snowflake. I would love to help test or with some guidance add some additional support for completion. The show tables function errors out with a bad query, but describe table at point works. So for now to get completion of fields, I use C-h t to open a buffer describing the table and expansion will use that buffer as a source when editing the SQL.
If nothing else, I could share the config if you wanted to add to the readme.
The text was updated successfully, but these errors were encountered: