Developing Snowflake UDFs with IntelliJ IDEA or VS Code

I buried the lead in my last article.

I received great feedback on my last article and associated GitHub repo and Gradle plugin. One developer — who had never used Gradle — thought the plugin looked interesting but would prefer not to use the command line and asked about options for integrating with popular IDEs. I realized I had brushed over Gradle too quickly and perhaps wholly buried the lead.

The main entry point for Gradle is indeed the command line, using either the gradle command if you have it installed locally, or the ./gradlew command, which executes the Gradle Wrapper included in the Git repository for most Gradle projects. IntelliJ IDEA and VS Studio Code offer integrations for working with Gradle, so our new plugin provides a seamless way to do Snowflake Java development using either IDE.

The IntelliJ IDEA Gradle Plugin

The IntelliJ plugin for Gradle is available in Preferences -> Plugins (on macOS), and I honestly can’t remember if it’s installed by default or needs to be selected after the fact. As the description explains, it can assist in creating a brand new project using Gradle or will auto-detect existing Gradle projects when opened and then offload some of the usual IntelliJ functionality (dependency resolution, test execution, etc.) to Gradle instead.

Integration with Gradle for building, testing, publishing, and deployment of software packages.

To demonstrate a Gradle project in IntelliJ, we can open the examples/internal-stage project from the GitHub repository, use the right Gradle sidebar and run the snowflakePublish task:

Output from executing the snowflakePublish command.

The last executed statement is visible in the main toolbar with a green run (▶️) arrow on the right, and the drop-down shows all recently executed tasks. This makes it simple to iterate and test our UDFs with zero developer friction.

The VS Code Gradle Extension Pack

The best way to add Gradle support to VS Code is to add the Gradle Extension Pack, which adds Gradle for Java and Gradle Language extensions. We get there by going to Preferences -> Extensions (on macOS), or simply using the left Extensions sidebar. Similar to IntelliJ, once this extension is installed, VS Code will automatically enable Gradle functionality for any Gradle project opened with it.

Gradle Extension Pack installs build and language support.

Now we can open the same sample project examples/internal-stage and use the new left Gradle sidebar to see or execute our tasks, including the snowflakePublish task:

Output from executing the snowflakePublish command.

Snowflake Plugin Roadmap

I mentioned the roadmap in my last article and responded to some feedback for GCS support, which I added. Tell me which of these features interests you by upvoting, or feel free to add some new ones. And as always, jump in with a pull request if you want to contribute.

--

--

Stewart Bryson
Snowflake Builders Blog: Data Engineers, App Developers, AI/ML, & Data Science

Snowflake Data Superhero | Oracle ACE Alum | Writer, speaker, podcast guest | Amateur cyclist | Professional philosopher