Registry / database / snowflake-connector-python

snowflake-connector-python

JSON →
library4.7.2pypypi✓ verified 25d ago

The Snowflake Connector for Python provides a standard Python interface to connect to Snowflake, execute queries, and fetch results. It's the core driver for interacting with Snowflake from Python applications. The current stable version is 1.12.0, and the library is actively maintained with frequent releases, typically on a monthly or bi-monthly cadence.

pip install snowflake-connector-python
INSTALL
IMPORT
SIG · SNOWFLAKE-CONNECTO
S
snowflake-connector-python
databasepythonv4.7.2
Install
11.6s avg
Import
2564ms
Disk
91MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.7.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 11.6s · import 2.564s · 92MB
91MB installed
● package 91MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

connect
from snowflake.connector import connect
The primary function to establish a connection to Snowflake.
ProgrammingError
from snowflake.connector.errors import ProgrammingError
Common error type for database-related issues.

This quickstart demonstrates how to establish a basic connection to Snowflake using environment variables for credentials and execute a simple query. Remember to replace the placeholder environment variables with your actual Snowflake credentials for a successful connection. Proper resource cleanup is handled in the `finally` block.

import snowflake.connector import os # Set these environment variables before running, or replace with your actual credentials: # export SNOWFLAKE_USER="your_username" # export SNOWFLAKE_PASSWORD="your_password" # export SNOWFLAKE_ACCOUNT="your_account_identifier" # e.g., 'yourorg-youraccount.us-east-1.aws' # export SNOWFLAKE_WAREHOUSE="your_warehouse_name" # export SNOWFLAKE_DATABASE="your_database_name" # export SNOWFLAKE_SCHEMA="your_schema_name" conn = None cur = None try: conn = snowflake.connector.connect( user=os.environ.get('SNOWFLAKE_USER', 'dummy_user'), password=os.environ.get('SNOWFLAKE_PASSWORD', 'dummy_password'), account=os.environ.get('SNOWFLAKE_ACCOUNT', 'dummy_account'), warehouse=os.environ.get('SNOWFLAKE_WAREHOUSE', 'dummy_warehouse'), database=os.environ.get('SNOWFLAKE_DATABASE', 'dummy_database'), schema=os.environ.get('SNOWFLAKE_SCHEMA', 'dummy_schema') ) cur = conn.cursor() cur.execute("SELECT current_version()") one_row = cur.fetchone() print(f"Successfully connected. Snowflake version: {one_row[0]}") except snowflake.connector.errors.ProgrammingError as e: print(f"Snowflake connection or query error: {e}") print("Please ensure environment variables (SNOWFLAKE_USER, SNOWFLAKE_PASSWORD, SNOWFLAKE_ACCOUNT, etc.) are correctly set.") except Exception as e: print(f"An unexpected error occurred: {e}") finally: if cur: cur.close() if conn: conn.close()
Debug
Known issues
gotchaStrict Python Version Requirements
fix
Ensure your Python environment is within the supported range (e.g., Python 3.10 to 3.13 for current 1.x versions). Check PyPI for the `Requires: Python` metadata.
affects: All 1.x versions
gotchaOptional `pyarrow` dependency is critical for performance with Pandas
fix
For optimal performance when fetching large datasets or using `fetch_pandas_all`, install `pyarrow` separately or use the `pandas` extra: `pip install "snowflake-connector-python[pandas]"`.
affects: All 1.x versions
gotchaSnowflake account identifier format can be complex
fix
The `account` parameter must be your full Snowflake account identifier, which can vary based on region and cloud provider (e.g., `myorg-myaccount.us-east-1.aws`). Consult your Snowflake administrator or documentation for the exact format.
affects: All versions
breakingSignificant changes in connection parameters and error handling from `0.x` to `1.x`
fix
If migrating from an older `0.x` version, review the official documentation for `1.x` regarding updated connection parameter names (e.g., `account` instead of `host`) and the new error handling classes like `snowflake.connector.errors.ProgrammingError`.
affects: Users migrating from 0.x to 1.x versions
breakingBuilding 'snowflake-connector-python' requires a C++ compiler.
fix
Ensure a C++ compiler (like `g++` or `build-base` on Alpine Linux) is installed in your environment before attempting to install the package. For Alpine-based images, you typically need to run `apk add build-base`.
affects: All 1.x versions
Errors
Common errors & fixes
Failed to build wheel for cryptography
The `cryptography` package, a dependency of `snowflake-connector-python`, requires specific system build tools (like C++ compilers or development headers) which are missing.
fix
Install the necessary build tools for your operating system (e.g., `build-essential` on Linux, XCode command line tools on macOS, or Visual C++ Build Tools on Windows), then retry `pip install snowflake-connector-python`. Often updating `pip` and `setuptools` first can help: `python -m pip install --upgrade pip setuptools wheel`.
Failed to connect to DB: <account_name>.snowflakecomputing.com:443
This error indicates a network connectivity issue, an incorrect Snowflake account identifier, firewall blocking, or proxy misconfiguration preventing the client from reaching the Snowflake endpoint.
fix
Verify the Snowflake account identifier (e.g., `myaccount.us-east-1` vs `myaccount`), check network connectivity, firewall rules, and proxy settings, ensuring the client can reach `*.snowflakecomputing.com` on port 443.
Invalid username or password.
The provided username or password in the connection parameters is incorrect or does not match an existing Snowflake user.
fix
Double-check the username and password for typos, verify that the user exists, and ensure the credentials are correct; consider using key-pair authentication for robust credential management.
snowflake.connector.errors.ProgrammingError: 002043 (02000): SQL compilation error:
The SQL query being executed contains a syntax error, refers to non-existent database objects (table, column), or has other issues preventing Snowflake from successfully compiling or executing it.
fix
Carefully review the SQL query for syntax errors, verify that all referenced tables, schemas, and databases exist and are accessible to the connecting user, and ensure correct object casing.
Upgrade
Version history
4.7.2latest on PyPI · released Aug 7, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
18
Meta
2
Resources