How to Integrate Hex and Databricks Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair hex and databricks to run notebooks and build data apps on lakehouse tables. Analysts write SQL and Python in Hex while compute clusters in Databricks process the data. This setup lets teams share charts and reports with business users across the company. Without clear rules, shared credentials can expose sensitive rows to every app viewer. How hex and databricks share data and identities Hex sends queries over the network to a compute cluster or SQL warehouse in Databricks. You c

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.

Teams pair hex and databricks to run notebooks and build data apps on lakehouse tables. Analysts write SQL and Python in Hex while compute clusters in Databricks process the data.

This setup lets teams share charts and reports with business users across the company. Without clear rules, shared credentials can expose sensitive rows to every app viewer.

How hex and databricks share data and identities

Hex sends queries over the network to a compute cluster or SQL warehouse in Databricks. You can set up this link with a shared key or individual user logins.

When a team uses a shared service key, every notebook query runs as one user. Databricks sees the service identity instead of the person who opened the Hex notebook.

OAuth login fixes this gap for interactive work in the workspace. Each analyst logs in with their own identity, and Databricks checks their catalog roles.

Published Hex apps often fall back to a shared account for background runs. You must scope that account so app viewers do not read private tables.

Data flows back to Hex in batches or dataframes for local Python tasks. From there, analysts join tables, build charts, and share views with their peers.

Common failure modes and how to scope roles

The biggest risk in this setup is a broad personal token pasted into Hex. If that token belongs to an admin, any notebook editor can read all tables.

Another common issue is unlogged queries from shared workspace links. Security teams see thousands of reads in the log, but cannot name the person.

Network paths can also stay too open between the cloud workspace and the cluster. Leaving warehouse endpoints open to the public web invites brute force login attempts.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Start by creating a dedicated service principal for each Hex project or team. Grant that identity read rights only to the schemas needed for those apps.

Remove write permissions unless a notebook must save results back to a gold table. When a project needs write rights, restrict them to one isolated scratch schema.

Turn on OAuth for all analyst exploration so catalog rules apply to each person. Set short lifetimes on all tokens and rotate service credentials on a fixed schedule.

Protecting sensitive columns in notebook outputs

Analysts often pull customer tables into Python memory to test new chart ideas. Once a dataframe loads in Hex, raw values can stay in cached cell outputs.

A shared app might display emails, phone numbers, or card numbers by mistake. Even if you hide the code cell, downstream charts or exports can leak data.

Use catalog views or dynamic masking rules to protect private columns before data leaves. Masking rewrites matched fields in results so analysts work with safe values.

For example, you can redact national IDs and phone numbers in customer tables. Analysts still count rows and group by state, while sensitive strings stay masked.

Review workspace sharing settings so guests cannot export raw CSV files from published apps. Combine tight catalog roles with network allowlists to keep your data lakehouse safe.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Should we use personal tokens or OAuth for Hex and Databricks?

Use OAuth for analyst notebooks so each query runs under the user's own role. Use a scoped service principal only for scheduled jobs and published apps.

How do we stop Hex apps from reading restricted tables?

Create a dedicated role for the app and grant read rights to specific views. Never link a published app to an admin account or a broad catalog role.

How can we protect PII when analysts use Python cells in Hex?

Apply masking to emails, phone numbers, and card numbers before results reach the notebook. Masking rewrites matched fields in results so cached dataframes hold redacted text.

The query runs. The emails stay hidden.