{"id":807,"library":"snowflake-snowpark-python","title":"Snowflake Snowpark Python","description":"Snowflake Snowpark for Python provides an intuitive API for querying and processing data in Snowflake using Python. It enables data engineers and data scientists to build scalable data pipelines and machine learning workflows directly within Snowflake, leveraging its elastic, scalable, and secure engine. The library is actively maintained with frequent releases, typically every few weeks, bringing new features, improvements, and bug fixes.","status":"active","version":"1.48.0","language":"python","source_language":"en","source_url":"https://github.com/snowflakedb/snowpark-python","tags":["snowflake","data-warehousing","etl","data-processing","dataframe","udf","stored-procedures"],"install":[{"cmd":"pip install snowflake-snowpark-python","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Snowpark Python 1.24.0 was the last client and server version to support Python 3.8. Requires Python >=3.9 and <3.14.","package":"python","optional":false},{"reason":"Underlying connector for Snowflake connectivity.","package":"snowflake-connector-python","optional":false},{"reason":"Required for certain functionalities, ensure compatibility with other libraries.","package":"protobuf","optional":false},{"reason":"Runtime dependency for timezone handling.","package":"tzlocal","optional":false}],"imports":[{"symbol":"Session","correct":"from snowflake.snowpark import Session"},{"note":"Commonly aliased as 'F' for convenience: `import snowflake.snowpark.functions as F`","symbol":"functions","correct":"from snowflake.snowpark import functions"},{"note":"Used for specifying UDF/UDTF input/return types.","symbol":"types","correct":"from snowflake.snowpark import types"},{"note":"The `DataFrame` class is generally not imported directly by users; instances are created via `Session` methods like `create_dataframe`, `table`, or `sql`.","wrong":"from snowflake.snowpark import DataFrame","symbol":"DataFrame","correct":"df = session.create_dataframe(...) # DataFrame objects are typically returned by Session methods."}],"quickstart":{"code":"import os\nfrom snowflake.snowpark import Session\nfrom snowflake.snowpark.functions import col\n\n# Establish a Snowpark Session using environment variables\n# Replace with your actual connection parameters, or configure ~/.snowflake/connections.toml\nconnection_parameters = {\n    \"account\": os.environ.get(\"SNOWFLAKE_ACCOUNT\", \"your_account_identifier\"),\n    \"user\": os.environ.get(\"SNOWFLAKE_USER\", \"your_username\"),\n    \"password\": os.environ.get(\"SNOWFLAKE_PASSWORD\", \"your_password\"),\n    \"role\": os.environ.get(\"SNOWFLAKE_ROLE\", \"your_role\"),\n    \"warehouse\": os.environ.get(\"SNOWFLAKE_WAREHOUSE\", \"your_warehouse\"),\n    \"database\": os.environ.get(\"SNOWFLAKE_DATABASE\", \"your_database\"),\n    \"schema\": os.environ.get(\"SNOWFLAKE_SCHEMA\", \"your_schema\"),\n}\n\nsession = Session.builder.configs(connection_parameters).create()\nprint(\"Snowpark Session created successfully.\")\n\n# Create a simple DataFrame\ndata = [(\"Alice\", 1), (\"Bob\", 2), (\"Charlie\", 3)]\ndf = session.create_dataframe(data, schema=[\"name\", \"id\"])\n\n# Perform a simple transformation and show results\ndf.filter(col(\"id\") > 1).show()\n\n# Close the session\nsession.close()\nprint(\"Snowpark Session closed.\")","lang":"python","description":"This quickstart demonstrates how to establish a Snowpark Session, create a DataFrame from local data, perform a basic transformation, and display the results. Connection parameters are loaded from environment variables for secure and flexible setup. Remember to replace placeholder values with your Snowflake account details."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or greater. The library now requires Python >=3.9, <3.14.","message":"Snowpark Python has dropped support for Python 3.8. Version 1.24.0 was the last to support it. Using Snowpark Python with Python 3.8 will trigger deprecation warnings.","severity":"breaking","affected_versions":"<1.24.0 (Python 3.8 users)"},{"fix":"For targeted delete-insert operations, use the `overwrite_condition` parameter (available since v1.44.0) with `mode='overwrite'`. If you need to preserve grants, specify `copy_grants=True` where applicable.","message":"The default 'overwrite' mode for `DataFrameWriter.save_as_table` drops and recreates the target table, leading to potential data loss for non-matching rows and impacting grants. This can be unexpected if partial updates are desired.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To use session-level imports or packages, pass `None` or omit the `imports`/`packages` argument. To explicitly use no imports/packages, pass an empty list `[]`.","message":"When registering UDFs/SPROCs, specifying an empty list (`[]`) for the `imports` or `packages` argument now explicitly means *no* imports/packages for that specific UDF/SPROC. This behavior changed from older versions where an empty list implicitly meant using session-level imports/packages.","severity":"gotcha","affected_versions":">=1.0.0 (Behavior changed in v1.0.0, released 2022-11-01)"},{"fix":"Upgrade to `snowflake-snowpark-python` version 1.47.0 or higher.","message":"A bug existed where `Session.udf.register_from_file` did not properly process the `strict` and `secure` parameters, potentially leading to UDFs not being created with the intended security or null-handling characteristics.","severity":"bug","affected_versions":"<1.47.0"},{"fix":"Prioritize packages from Snowflake's Anaconda channel. For custom or unavailable packages, zip them and upload to a Snowflake stage. Reference these staged files using the `imports` parameter when registering UDFs/SPROCs.","message":"Managing Python packages not available in Snowflake's Anaconda channel for UDFs and stored procedures can be complex. These often require manual zipping and uploading to Snowflake stages, and careful management of `imports` and `packages` parameters.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure all required connection parameters (e.g., `account`, `user`, `password`/`authenticator`, `role`, `warehouse`, `database`, `schema`) are correctly provided and formatted. Double-check the account identifier and region in your connection string. Refer to the Snowflake documentation for correct connection string formats and parameter requirements.","message":"Attempting to create a Snowpark session with incorrect or incomplete connection parameters can result in an `HttpError: 404 Not Found` during the login process, indicating that the Snowflake endpoint could not be reached or is invalid.","severity":"breaking","affected_versions":"All versions"},{"fix":"Install the required C/C++ compiler toolchain in your environment. For Alpine Linux, use `apk add build-base`. For Debian/Ubuntu, use `apt-get install build-essential`. For other operating systems, refer to their documentation for installing development tools.","message":"Building `snowflake-connector-python` fails due to a missing C/C++ compiler toolchain (e.g., for Arrow support) in the environment. This error typically appears as 'g++: No such file or directory' during the wheel build process.","severity":"breaking","affected_versions":"All versions (when building from source without necessary build tools)"}],"env_vars":null,"search_vec":"'activ':50 'api':11 'bring':59 'bug':64 'build':29 'data':16,23,26,31,68,72 'data-process':71 'data-wareh':67 'datafram':74 'direct':37 'elast':42 'enabl':22 'engin':24,46 'etl':70 'everi':56 'featur':61 'fix':65 'frequent':53 'improv':62 'intuit':10 'learn':35 'leverag':40 'librari':48 'machin':34 'maintain':51 'new':60 'pipelin':32 'procedur':78 'process':15,73 'provid':8 'python':3,7,20 'queri':13 'releas':54 'scalabl':30,43 'scientist':27 'secur':45 'snowflak':1,4,18,39,66 'snowpark':2,5 'store':77 'stored-procedur':76 'typic':55 'udf':75 'use':19 'wareh':69 'week':58 'within':38 'workflow':36","created_at":"2026-03-29T04:22:33.280216+00:00","updated_at":"2026-04-16T21:54:16.386190+00:00","problems":[{"fix":"Run `pip install snowflake-snowpark-python` in your terminal to install the library.","cause":"The `snowflake-snowpark-python` library is not installed in the Python environment or the environment is not correctly activated.","error":"ModuleNotFoundError: No module named 'snowflake.snowpark'"},{"fix":"Verify all connection parameters are correctly provided in the dictionary passed to `Session.builder.configs()` and ensure your network can reach Snowflake.","cause":"One or more required connection parameters (e.g., account, user, password, role, warehouse, database, schema) are missing, incorrect, or the provided credentials are invalid.","error":"snowflake.snowpark.exceptions.SnowparkClientException: Failed to connect to Snowflake. Please check your connection parameters."},{"fix":"Use `Session.builder.configs({'account': 'your_account', 'user': 'your_user', 'password': 'your_password'}).create()` to build the session.","cause":"The Snowpark `SessionBuilder` API uses a single `configs()` method to pass all connection parameters as a dictionary, rather than individual setter methods like `account()`, `user()`, etc.","error":"AttributeError: 'SessionBuilder' object has no attribute 'account'"},{"fix":"Break down complex DataFrame operations into smaller steps by materializing intermediate results using `.cache_result()` or by saving to a temporary table with `.to_df_writer().save_as_table()`.","cause":"The sequence of Snowpark DataFrame transformations generates an underlying SQL query that exceeds Snowflake's internal limits for statement size or complexity.","error":"snowflake.snowpark.exceptions.SnowparkSQLException: SQL compilation error: Statement is too large or complex to compile."}],"ecosystem":"pypi","meta_description":null,"install_score":45,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.54.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.snowflake.com/","github":"https://github.com/snowflakedb/snowpark-python","docs":"https://docs.snowflake.com/en/developer-guide/snowpark/python/index.html","changelog":"https://github.com/snowflakedb/snowpark-python/blob/main/CHANGELOG.md","pypi":"https://pypi.org/project/snowflake-snowpark-python/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["aws","database","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":"draft"}}