Databricks to Snowflake notebook transformation¶
This document describes the transformation process from Databricks notebooks to Snowflake notebooks (vNext).
The transformation tool converts Databricks notebooks (.py format with # COMMAND ---------- markers) to Snowflake notebooks (.ipynb format), adapting Databricks-specific APIs to functional equivalents in Snowflake.
Input and output files¶
Input¶
File |
Description |
|---|---|
|
Databricks notebook with |
Output¶
File |
Description |
|---|---|
|
Transformed notebook for Snowflake |
Transformation example¶
Input file: dbx_with_dbutis_run.py ¶
Output file: dbx_with_dbutis_run.ipynb ¶
The transformed notebook contains the following cells:
Cell 0 - Connection configuration¶
Cell 1 - Utility imports¶
Cell 2 - dbutils help (unchanged)¶
Cell 3 - Notebook execution (transformed)¶
Cell 4 - Python code (unchanged)¶
Cell 5 - R code (with warning)¶
SPRKDBX1003 R cells code are not supported in Snowsight. You must rewrite the R code in Python.
For more information, see EWI codes in this topic.
Applied transformations¶
1. Addition of initialization cells¶
Cells are automatically added at the beginning of the notebook for:
Snowflake connection configuration (commented for customization)
Import of
sfutilsand Snowpark session creation
2. Conversion of dbutils.notebook.run()¶
Databricks |
Snowflake |
|---|---|
|
|
3. Handling of unsupported language cells¶
Cells with # MAGIC %r (R) or # MAGIC %scala (Scala) are marked with an EWI (Early Warning Issue) comment:
For more information, see EWI codes in this topic.
EWI codes (early warning issues)¶
During transformation, warnings may be generated for code that requires manual review:
Code |
Description |
|---|---|
|
R cell code is not supported in Snowsight. Requires rewriting in Python |
Important considerations¶
Snowflake Session: The transformed notebook automatically initializes a Snowpark session.
R/Scala Cells: Require manual migration to Python.
Notebook Execution:
dbutils.notebook.run()is converted tosfutils.notebook.run().
Recommended workflow¶
Databricks Notebook (.py with COMMAND)
Transformation Tool
Snowflake Notebook (.ipynb)