Run Python, Spark, and ML workloads directly on Snowflake with Code Bundles
Package Python, Spark, or ML code without stored procedures and execute it directly on Snowflake compute using simple commands.
O que mudou
Code Bundles (formerly Notebook Projects) let you package non-SQL code, such as Python scripts, and run it directly on Snowflake compute. Snowflake automatically injects a Snowpark session at runtime, giving your code direct access to data without manual credential management.
Use cases
Imagine you have Python ETL scripts or ML applications and want to run them without building complex containers or wrapping logic in stored procedures.
- Run Python code on virtual warehouses or compute pools.
- Submit Spark jobs using Snowpark Connect.
- Run Machine Learning workloads using the Snowflake Container Runtime.
How to use
Create a configuration file named code_bundle.yml at the root of your project specifying the bundle type and compute target.
bundle:
type: custom
compute_type: warehouse
language: python
compute_options:
runtime_version: '3.11'
properties:
requirements_file: requirements.txt
What happens in this code:
- Sets the bundle type to
customfor Python scripts. - Configures execution to run on a virtual warehouse.
- Specifies the Python 3.11 runtime version.
- References a requirements file for automatic dependency installation.
Next, create and execute the bundle using the Snowflake CLI:
snow bundle create MY_BUNDLE --source ./my_project --exclude "venv/**"
snow bundle execute MY_BUNDLE --entrypoint main.py
What happens in this code:
- Creates a Code Bundle named
MY_BUNDLEfrom a local directory while excluding virtual environments. - Executes the entrypoint script
main.pydirectly on Snowflake compute.
Limitations and requirements
- Scheduling notebooks on compute pools is generally available (GA).
- Warehouse execution, Spark job submission, ML jobs, inline specification overrides, and the REST API, Python API, and Snowflake CLI clients are in Public Preview.
- Requires
CREATE CODE BUNDLEpermission on the schema or account, plusOWNERSHIPorUSAGEon the Code Bundle to execute it.
- code bundles
- python
- spark
- snowpark container services
- snowflake cli
Code Bundles (Preview)
Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.
Relacionadas
- SnowflakeGA
Geração de documentos em PDF, Word e PowerPoint no Snowflake CoWork
O Snowflake CoWork agora gera arquivos PDF, Word, PowerPoint e HTML diretamente de suas análises usando a ferramenta de execução de código do Cortex Agent.
snowflake cowork · cortex agent - SnowflakePublic Preview
Cortex Agent SDK para Python e TypeScript no Snowflake
O Cortex Agent SDK permite criar aplicações que utilizam Cortex Agents e Cortex Code em Python e TypeScript.
cortex agents · python - SnowflakeAtualização
Mensagens de erro mais detalhadas na classificação de dados sensíveis
A view DATA_CLASSIFICATION_LATEST agora traz mensagens de erro específicas e códigos do Snowflake para falhas na classificação.
data governance · trust center