Snowpark Developer Guide for Python¶
The Snowpark library provides an intuitive API for querying and processing data in a data pipeline. Using the Snowpark library, you can build applications that process data in Snowflake without moving data to the system where your application code runs. You can also automate data transformation and processing by writing stored procedures and scheduling those procedures as tasks in Snowflake.
You can write Snowpark Python code in a local development environment or in a Python worksheet in Snowsight.
If you need to write a client application, set up a local development environment by doing the following:
Set up your preferred development environment to build Snowpark apps. Refer to Setting Up Your Development Environment for Snowpark Python.
Establish a session to interact with the Snowflake database. Refer to Creating a Session for Snowpark Python.
If you want to write a stored procedure to automate tasks in Snowflake, use Python worksheets in Snowsight. Refer to Writing Snowpark Code in Python Worksheets.
Write Snowpark Python Code¶
You can query, process, and transform data in a variety of ways using Snowpark Python.
Query and process data with a
DataFrameobject. Refer to Working with DataFrames in Snowpark Python.
Convert custom lambdas and functions to user-defined functions (UDFs) that you can call to process data. Refer to Creating User-Defined Functions (UDFs) for DataFrames in Python.
Write a user-defined tabular function (UDTF) that processes data and returns data in a set of rows with one or more columns. Refer to Creating User-Defined Table Functions (UDTFs) for DataFrames in Python.
Write a stored procedure that you can call to process data, or automate with a task to build a data pipeline. Refer to Creating Stored Procedures for DataFrames in Python.
Perform Machine Learning Tasks¶
You can use Snowpark Python to perform machine learning tasks like training models:
Train machine learning models by writing stored procedures. Refer to Training Machine Learning Models with Snowpark Python.
Train, score, and tune machine learning models using Snowpark Python stored procedures and deploy the trained models with user-defined functions. Refer to Machine Learning with Snowpark Python - Credit Card Approval Prediction (Snowflake Quickstarts).
Troubleshoot Snowpark Python Code¶
Troubleshoot your code with logging statements and by viewing the underlying SQL. Refer to Troubleshooting with Snowpark Python.