How to Integrate Hex and Snowflake Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Data teams pair hex and snowflake to run SQL queries and build shared notebooks. Hex sends queries to your Snowflake warehouse and turns results into charts and apps. This setup lets analysts explore big tables and share live reports with business teams. Still, poor role setup can expose private data or hide who ran a query. A safe design uses tight database roles, individual user logins, and clear audit logs. How hex and snowflake share queries and data Hex acts as a workspace where users w

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Data teams pair hex and snowflake to run SQL queries and build shared notebooks. Hex sends queries to your Snowflake warehouse and turns results into charts and apps.

This setup lets analysts explore big tables and share live reports with business teams. Still, poor role setup can expose private data or hide who ran a query. A safe design uses tight database roles, individual user logins, and clear audit logs.

How hex and snowflake share queries and data

Hex acts as a workspace where users write SQL and Python in one place. When a user runs a cell, Hex sends that SQL text to Snowflake. Snowflake runs the compute job on a virtual warehouse and returns the rows.

You can set up this link using a shared service account or individual logins. With a shared account, every notebook query runs under one database user name. With OAuth, each analyst logs in with their own Snowflake identity and role. Individual logins make it much easier to track who ran each query.

Once rows return to the notebook, analysts can chain queries or run Python scripts. Published apps can also run queries when viewers change filters on a page. Because apps run live queries, you must scope warehouse permissions with great care.

Common risks with shared service accounts

Many teams start by putting one strong database role into their Hex workspace settings. This shortcut creates three big security gaps for your data platform. First, every analyst gets the same broad table permissions inside the workspace. Anyone who can edit a notebook can read every table tied to that role.

Second, your Snowflake query history will show one user name for all activity. When a bad query spikes costs, you cannot see which person wrote it. Compliance teams also lose the trail of who read sensitive customer rows.

Snowflake Access Control + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Third, published apps may expose raw data if notebook permissions are too broad. A viewer could trigger a query that pulls fields like emails or phone numbers. Static keys stored in workspace settings can also leak if you never rotate them.

Scoping roles and network paths between systems

Start by creating a dedicated, read-only role in Snowflake for your notebook projects. Grant this role permission to read only the specific schemas needed for reporting. Never give a workspace role admin rights or broad write permissions core tables.

Turn on OAuth for interactive work so each analyst uses their own database role. For scheduled runs or public apps, use a separate service account with narrow rights. Use key-pair login instead of static passwords for any automated service user.

Protect sensitive columns before they ever leave your cloud data warehouse. Set up masking rules in Snowflake to rewrite emails, phone numbers, and card numbers. Masking rewrites matched fields in query results based on the active database role. Finally, lock down network rules so Snowflake only accepts traffic from known IP ranges.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Should we use OAuth or a service account for Hex?

Use OAuth for analysts editing notebooks so logs show individual user names. Use a tightly scoped service account only for scheduled jobs and published apps.

How do we stop notebooks from driving up warehouse costs?

Assign a dedicated, small virtual warehouse to your Hex role in Snowflake. Set a short query timeout and a strict monthly credit limit on that warehouse.

How can we protect PII in shared notebook apps?

Apply column masking rules in Snowflake to rewrite emails, phone numbers, and national IDs. Keep the app role restricted to clean, aggregated views rather than raw tables.

The query runs. The emails stay hidden.