Configure Snowpark (Snowflake API for Python) with Anaconda

Ashok Bhatla
2 min readJul 19, 2022

This article describes basic steps as to how to configure Anaconda with SnowPark (Snowflake API for Python)

Official guide from Snowflake about SnowPark can be found at this URL

https://docs.snowflake.com/en/developer-guide/snowpark/python/setup.html

The Snowpark API requires Python 3.8.

Following article describes how to install ANACONDA on Windows.

https://www.geeksforgeeks.org/how-to-install-anaconda-on-windows/

Anaconda comes with a default environment for development. It is better to create a separate environment in Anaconda for SnowPark Testing. Following script will create anaconda environment called “snowpark” with python 3.8

From a command prompt window, run the following commands to install Snowpark environment

conda create — name snowpark -c https://repo.anaconda.com/pkgs/snowflake python=3.8

Once Snowpark is installed in ANACONDA, we have to activate Snowpark with the following command

conda activate snowpark

Results of this command will show the anaconda environment changed from “base” to “snowpark”

In order to confirm that Snowpark is activated, we can use the following command

conda info –envs

This command will show a list of conda environments and should display “snowpark” as one of the environment.

Once Anaconda environment is ready, install the Snowpark Python package using the PIP command

pip install snowflake-snowpark-python

If you want to install with PANDAS package, use the following command.

pip install “snowflake-snowpark-python[pandas]”

We can verify the Snowpark installation using the following command

conda list snowpark

Once it is confirmed that SnowPark is properly configured, you can use Juypter Notebook to make a connection to SnowPark.

Source — docs.snowflake.com

For better security, Snowflake Connection parameters can be given in a CONFIG.JSON file and then that file can be called from the Python script. Example shown in the script below.

PYTHON SCRIPT READING A CONFIG.JSON File to make a Connection to Snowflake.

Once connection is established to Snowflake, system is ready to run any SQL queries.

--

--

Ashok Bhatla

Everything Data — Project Manager, Data Analytics. These are my views - not of my employer