Snowflake Connector for Python

4.4.0 · active · verified Sat Mar 28

The Snowflake Connector for Python enables Python applications to connect to Snowflake, a cloud-based data warehousing service. It conforms to the Python DB API 2.0 specification and is actively maintained, with the latest release being version 4.4.0 on March 24, 2026. The connector is compatible with Python versions 3.9 and above, including the newly supported Python 3.14. It follows a regular release cadence, with updates addressing security vulnerabilities, performance improvements, and new features.

Warnings

Install

Imports

Quickstart

This script demonstrates how to connect to Snowflake using the Snowflake Connector for Python. It retrieves the current Snowflake version by executing a simple query. Credentials are securely managed using environment variables, which is a recommended practice for handling sensitive information. Ensure that the necessary environment variables are set before running the script.

import os
from snowflake.connector import connect

# Establish a connection using environment variables for credentials
conn = connect(
    user=os.environ.get('SNOWFLAKE_USER', ''),
    password=os.environ.get('SNOWFLAKE_PASSWORD', ''),
    account=os.environ.get('SNOWFLAKE_ACCOUNT', ''),
    warehouse=os.environ.get('SNOWFLAKE_WAREHOUSE', ''),
    database=os.environ.get('SNOWFLAKE_DATABASE', ''),
    schema=os.environ.get('SNOWFLAKE_SCHEMA', '')
)

# Create a cursor object
cur = conn.cursor()

# Execute a simple query
cur.execute('SELECT CURRENT_VERSION()')

# Fetch the result
result = cur.fetchone()
print(f'Snowflake version: {result[0]}')

# Close the cursor and connection
cur.close()
conn.close()

view raw JSON →