{"id":373,"library":"snowflake-connector-python","title":"Snowflake Connector for Python","description":"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.","status":"active","version":"1.12.0","language":"python","source_language":"en","source_url":"https://github.com/snowflakedb/snowflake-connector-python","tags":["database","sql","data_warehouse","snowflake","etl","data_engineering"],"install":[{"cmd":"pip install snowflake-connector-python","lang":"bash","label":"Install core connector"},{"cmd":"pip install \"snowflake-connector-python[pandas]\"","lang":"bash","label":"Install with Pandas and PyArrow support"}],"dependencies":[],"imports":[{"note":"The primary function to establish a connection to Snowflake.","symbol":"connect","correct":"from snowflake.connector import connect"},{"note":"Common error type for database-related issues.","symbol":"ProgrammingError","correct":"from snowflake.connector.errors import ProgrammingError"}],"quickstart":{"code":"import snowflake.connector\nimport os\n\n# Set these environment variables before running, or replace with your actual credentials:\n# export SNOWFLAKE_USER=\"your_username\"\n# export SNOWFLAKE_PASSWORD=\"your_password\"\n# export SNOWFLAKE_ACCOUNT=\"your_account_identifier\" # e.g., 'yourorg-youraccount.us-east-1.aws'\n# export SNOWFLAKE_WAREHOUSE=\"your_warehouse_name\"\n# export SNOWFLAKE_DATABASE=\"your_database_name\"\n# export SNOWFLAKE_SCHEMA=\"your_schema_name\"\n\nconn = None\ncur = None\n\ntry:\n    conn = snowflake.connector.connect(\n        user=os.environ.get('SNOWFLAKE_USER', 'dummy_user'),\n        password=os.environ.get('SNOWFLAKE_PASSWORD', 'dummy_password'),\n        account=os.environ.get('SNOWFLAKE_ACCOUNT', 'dummy_account'),\n        warehouse=os.environ.get('SNOWFLAKE_WAREHOUSE', 'dummy_warehouse'),\n        database=os.environ.get('SNOWFLAKE_DATABASE', 'dummy_database'),\n        schema=os.environ.get('SNOWFLAKE_SCHEMA', 'dummy_schema')\n    )\n\n    cur = conn.cursor()\n    cur.execute(\"SELECT current_version()\")\n    one_row = cur.fetchone()\n    print(f\"Successfully connected. Snowflake version: {one_row[0]}\")\n\nexcept snowflake.connector.errors.ProgrammingError as e:\n    print(f\"Snowflake connection or query error: {e}\")\n    print(\"Please ensure environment variables (SNOWFLAKE_USER, SNOWFLAKE_PASSWORD, SNOWFLAKE_ACCOUNT, etc.) are correctly set.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\nfinally:\n    if cur:\n        cur.close()\n    if conn:\n        conn.close()\n","lang":"python","description":"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."},"warnings":[{"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.","message":"Strict Python Version Requirements","severity":"gotcha","affected_versions":"All 1.x versions"},{"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]\"`.","message":"Optional `pyarrow` dependency is critical for performance with Pandas","severity":"gotcha","affected_versions":"All 1.x versions"},{"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.","message":"Snowflake account identifier format can be complex","severity":"gotcha","affected_versions":"All versions"},{"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`.","message":"Significant changes in connection parameters and error handling from `0.x` to `1.x`","severity":"breaking","affected_versions":"Users migrating from 0.x to 1.x versions"},{"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`.","message":"Building 'snowflake-connector-python' requires a C++ compiler.","severity":"breaking","affected_versions":"All 1.x versions"}],"env_vars":null,"last_verified":"2026-05-12T13:23:25.825Z","next_check":"2026-07-08T00:00:00.000Z","problems":[{"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`.","cause":"The `cryptography` package, a dependency of `snowflake-connector-python`, requires specific system build tools (like C++ compilers or development headers) which are missing.","error":"Failed to build wheel for cryptography"},{"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.","cause":"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.","error":"Failed to connect to DB: <account_name>.snowflakecomputing.com:443"},{"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.","cause":"The provided username or password in the connection parameters is incorrect or does not match an existing Snowflake user.","error":"Invalid username or password."},{"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.","cause":"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.","error":"snowflake.connector.errors.ProgrammingError: 002043 (02000): SQL compilation error:"}],"ecosystem":"pypi","meta_description":null,"install_score":45,"install_tag":"draft","quickstart_score":30,"quickstart_tag":"draft","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"draft","tag_description":"notable install failures or slow imports","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pandas","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pandas","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.63,"mem_mb":56.4,"disk_size":"376M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.53,"mem_mb":29.6,"disk_size":"88M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pandas","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pandas","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.62,"mem_mb":64.1,"disk_size":"402M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.35,"mem_mb":33.6,"disk_size":"93M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pandas","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pandas","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":4.28,"mem_mb":62.8,"disk_size":"386M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.93,"mem_mb":33.3,"disk_size":"85M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pandas","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pandas","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.94,"mem_mb":63.1,"disk_size":"385M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.6,"mem_mb":34.8,"disk_size":"84M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pandas","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pandas","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.87,"mem_mb":56.4,"disk_size":"374M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.68,"mem_mb":29.5,"disk_size":"88M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"draft","tag_description":"notable failures across runtimes","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":0}]}}