Introducing Snowpark Python Code Support in Snowflake’s Visual Studio Code Extension

Big news! Our Snowflake Visual Studio Code extension now supports Snowpark Python! With this support, you now can:

  1. Debug your Snowpark Python code in Visual Studio Code.
  2. Get syntax highlighting and autocomplete for SQL embedded in your Python code.

This makes building and running data-intensive applications within Snowflake using Python even easier, boosting your data engineering workflow!

Debugging Snowpark Python Functions

Debugging Snowpark Python functions has become much easier with this latest addition to the Snowflake Extension. You no longer need to run your entire script or make any code changes to debug it. Now, you can effortlessly debug any of your Snowpark Python functions using your extension’s active Snowflake session.

Just create your Snowpark Python function with the first parameter as a Snowpark Session object. Look out for the inline option labeled Snowflake: Debug that appears above the function name, and with a simple click, you can execute the function, leveraging your active session through the extension. Plus, you have the flexibility to set breakpoints for more precise debugging.

Syntax Highlighting and Autocomplete for SQL in Python

Sometimes you need to use SQL in your Snowpark code, but it used to look like a blob of text. There’s no autocomplete and no syntax highlighting. This update changes that; now you get both autocomplete & syntax highlighting with SQL. You have two ways to achieve this:

Automatic Detection

Enable the Auto Detect Sql in Python extension setting. The extension automatically recognizes common SQL statements and enables SQL syntax highlighting & autocomplete.

Manual Denotation

If you prefer manual control, you can explicitly denote SQL statements within Python strings using comments. Use markers to indicate the beginning and end of your SQL statements. To mark the beginning, — startsql, --beginsql, --start-sql, or --begin-sql. Similarly, use --endsql or -- end-sql to indicate the end.

Jinja Template Syntax Highlighting

Sometimes you need to template your SQL statements, so we’ve also added basic syntax highlighting and bracket autocomplete for Jinja templates in Snowflake SQL.

With Snowpark Python code support, Snowflake Visual Studio Code Extension continues to empower developers with enhanced capabilities for developing and debugging Snowflake SQL within their Python workflows. Dive into your Snowflake projects with greater efficiency and ease than ever before!

Download the extension today and supercharge your Snowflake development experience. Visit our documentation page to learn more about these new capabilities.

Happy coding!

--

--