Using Hex + Snowflake with Git

By: Tyler White and Chase Romano

When sharing a project in Hex isn’t enough, you can synchronize your Snowflake workflows using Hex and GitHub or GitLab.

In this article, we’ll discuss what Hex is, how it integrates with Snowflake, and why you should consider integrating it with Git, with an example to keep our code consistent and updated.

What’s Hex?

Hex facilitates collaboration among data teams by enabling them to work seamlessly in Python, SQL, and no-code, enhancing their data capabilities. Hex provides images to choose from, simplifying the process of configuring and managing different Python versions, packages, connection configurations, and more.

Setting up the Python environment can be difficult, especially for beginners. That’s why having assistance is so helpful.

Hex + Snowflake

Hex became a Snowflake partner in September 2021, so the two platforms integrate well. It’s easy to get started with Hex through Snowflake’s Partner Connect.

Hex + Snowflake Diagram
Snowflake Quickstart — Building and deploying a time series forecast with Hex + Snowflake

Hex + VCS (Git sync)

While Hex has a version control engine built-in, they also allow synchronizing to a third-party managed version control system.

Viewing Git repo sync options in Hex settings.

Only Hex Admins have the authority to set up Git sync repositories. The repository access also requires approval from a repository admin. If these conditions are met, follow these steps:

  1. Go to the Settings → Integrations tab under the “Workspace” header.
  2. Click “Connect” for either GitHub or GitLab and complete the OAuth flow.
  3. Add a sync repository using the “+ Repository” button.
  4. Select a “publish” branch that will display the published version of your app.
  5. Decide whether Pull Requests are mandatory for publishing an app.
  6. Choose the Hex group authorized to write to the repository.
Syncing the Hex Project with a Git repo.

Each version of your project you save is a commit to your configured VCS. You can input text in the “What’s new?” field, becoming your commit message.

We can see synchronization occurs between systems.

The code used in the Hex project is saved in a YAML file. With Git sync, organizations can ensure that PR approvals are enforced to maintain quality control, codebase stability, and reliable metadata. This centralized metadata doesn’t have to be restricted to Hex alone.

Comparing working branch to main.

Conclusion

Now that we’ve persisted the Hex project in Git, we’ll explore scheduling capabilities in a future article.

--

--

Tyler White
Snowflake Builders Blog: Data Engineers, App Developers, AI/ML, & Data Science

I constantly seek new ways to learn, improve, and share my knowledge and experiences. Solutions Architect @ Snowflake.