Drivers
Sundeck supports the majority of Snowflake drivers. Below is an example that demonstrates how to connect to Sundeck via the Snowflake Python Connector. Similar technique can be used to connect to any other Snowflake driver.
Before you begin, make sure you can connect to Snowflake using simple Python program. A simple snippet of code is provided at the bottom of this page. Once you’ve confirmed that you can connect to Snowflake, follow the steps below.
- Sign in to Sundeck UI and navigate to the “Broker”/“Config” page.
- Save the Sundeck Broker URL in the Connection card (shown below).
- Modify the Python code by adding the
host
key (in addition to other parameters) to the connection parameters and executing Sundeck specific statement to verify that you are indeed connected to Sundeck platform:
import os
import snowflake.connector as sc
private_key_file = '<path>'
conn_params = {
'account': '<account_identifier>',
'user': '<user>',
'private_key_file': private_key_file,
'warehouse': '<warehouse>',
'database': '<database>',
'schema': '<schema>',
'host': '<connection string copied in step #2>'
}
ctx = sc.connect(**conn_params)
cs = ctx.cursor()
try:
cs.execute("show sundeck grants")
rows = cs.fetchall()
for row in rows:
print(row)
finally:
cs.close()
If your user does not have the Sundeck Admin grant, you might get an error indicating that showing Sundeck grants is not permitted. To fix this error, either connect with the user that has this privilege or navigate to Settings/Users in the Sundeck UI and grant your Snowflake user administrative privilege by clicking on “Grant Role to User” button.
Copy snipppet of python code, modify connection parameters and execute to make sure you can connect to Snowflake with Snowflake python connector:
import os
import snowflake.connector as sc
private_key_file = '<path>'
conn_params = {
'account': '<account_identifier>',
'user': '<user>',
'private_key_file': private_key_file,
'warehouse': '<warehouse>',
'database': '<database>',
'schema': '<schema>'
}
ctx = sc.connect(**conn_params)
cs = ctx.cursor()
try:
cs.execute("select current_version()")
one_row = cs.fetchone()
print(one_row[0])
finally:
cs.close()
Please refer to Snowflake documentation for specific Snowflake connection parameters that might apply to you and for troubleshooting connection issues.