Connecting to Snowflake from Domino

Overview


Snowflake is a cloud-based data-warehouse. This article describes how to connect to Snowflake from Domino. In order to connect successfully, you must have network connectivity between Snowflake and your Domino deployment.

 

 

 

Options for connecting to Snowflake from Domino


 

 

 

Connecting to Snowflake with Python


Domino recommends the Snowflake Python connector (snowflake-connector-python).

 

Environment setup

Use the Dockerfile instruction below to install snowflake-connector-python and it's dependencies in your environment.

RUN apt-get install -y libssl-dev libffi-dev && \
pip install -U pip && pip install --upgrade snowflake-connector-python

For a basic introduction to modifying Domino environments, watch this tutorial video.

 

Credential setup

There are several environment variables you should set up to store secure information about your Snowflake connection. Set the following as Domino environment variables on your user account:

  • SNOWFLAKE_USER
  • SNOWFLAKE_PASSWORD
  • SNOWFLAKE_ACCOUNT

Read Environment variables for secure credential storage to learn more about Domino environment variables. 

 

Usage

Read the Snowflake python connector documentation for detailed information on how to use the package. Below is a simple example for connecting where:

  • you have set up environment variables noted above
import snowflake.connector
import os
 
# Gets the version
ctx = snowflake.connector.connect(
    user=os.environ['SNOWFLAKE_USER'],
    password=os.environ['SNOWFLAKE_PASSWORD'],
    account=os.environ['SNOWFLAKE_ACCOUNT']
    )
cs = ctx.cursor()
try:
    cs.execute("SELECT current_version()")
    one_row = cs.fetchone()
    print(one_row[0])
finally:
    cs.close()
ctx.close()

Alternatively, you can use generic Python JDBC or ODBC tools to connect to Snowflake. However, they are not specialized for use with Snowflake. They may have inferior performance and will require more time to set up.

For more information on JDBC / ODBC connections, read:

https://docs.snowflake.net/manuals/user-guide/jdbc.html

https://docs.snowflake.net/manuals/user-guide/odbc.html

 

Was this article helpful?
0 out of 0 found this helpful