How to Integrate Hex and CockroachDB Safely
You link hex and cockroachdb by using the standard PostgreSQL wire protocol. This setup lets data teams run SQL queries and build notebooks on live data. Data analysts use notebooks to test models and build charts for the team. Operational databases hold the fresh records needed for these daily reports. Linking the two tools gives teams fast answers without moving data around. How data flows between hex and cockroachdb The notebook app talks to the database using standard PostgreSQL drivers.
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.
You link hex and cockroachdb by using the standard PostgreSQL wire protocol. This setup lets data teams run SQL queries and build notebooks on live data.
Data analysts use notebooks to test models and build charts for the team. Operational databases hold the fresh records needed for these daily reports. Linking the two tools gives teams fast answers without moving data around.
How data flows between hex and cockroachdb
The notebook app talks to the database using standard PostgreSQL drivers. You enter the database host, port, user, and password into the workspace settings. The database checks these login details and starts a secure session over TLS.
When an analyst runs a cell, the app sends a query over the network. The database reads the tables, runs the math, and sends the rows back. The notebook stores these results in memory so the user can build Python charts.
You can set up data links at the workspace level or project level. Workspace links let many team members share the same database login details. Project links keep the login scoped to one single notebook and its authors.
Common risks with shared database logins
Many teams use one shared service account for all their notebook users. This setup creates big security gaps and makes database logs hard to read. When a bad query slows down the cluster, you cannot see who wrote it. Every query in the database log just shows the same shared app user.
Shared accounts also tend to gain too many table rights over time. One project might need access to billing tables while another needs user logs. If both projects share one login, every analyst can read all those tables. A single leaked password or open notebook can expose all your company data.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Query load is another major risk when linking notebooks to live transactional nodes. An analyst might run a huge join by mistake during peak business hours. That heavy read query can take up CPU and slow down customer apps.
How to scope roles and network paths
Start by creating a read-only SQL role just for your notebook users. Never use an admin account or the same role your backend apps use. Grant select rights only on the exact schemas and tables needed for charts.
If different teams use the app, make a separate role for each team. Give the finance team a finance role and the product team a product role. This setup limits what data each group can pull into their notebooks.
Next, lock down the network path between the notebook servers and your cluster. Use IP allowlists so the database only accepts traffic from known app addresses. For tighter security, route traffic through a private network link instead of the public web.
You should also set resource limits on the database role used for notebooks. Put a cap on query run times to kill slow queries right away. This simple rule keeps heavy notebook work from hurting your live production traffic. Finally, watch out for private data like emails, phone numbers, and card numbers. Keep raw tables with national IDs out of the schemas used for general charts.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Why do we use the PostgreSQL driver for this setup?
The database speaks the PostgreSQL wire protocol out of the box. This design lets any tool with a Postgres driver link to it without custom plugins.
How can we keep notebook queries from slowing down live apps?
Set statement timeouts on the read-only role used by your data analysts. You can also route analytical reads to follower nodes if your cluster setup supports it.
What happens when raw tables hold sensitive customer fields?
Analysts pulling full tables into Python memory might expose emails or card numbers. You should restrict access to raw tables or use masking to rewrite matched fields in results.
Related guides
In this post