How to Configure Haystack CockroachDB Connect

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a haystack cockroachdb connect flow by linking a Postgres driver to your cluster. Then you pass your database role details into the document store component. Many teams start this setup by sharing a single admin login across all pipeline nodes. That broad role lets the app read or delete any table in the database. One bad prompt or code bug can wipe out production rows or expose private records. How a native haystack cockroachdb connect setup works CockroachDB speaks the standard P

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 set up a haystack cockroachdb connect flow by linking a Postgres driver to your cluster. Then you pass your database role details into the document store component. Many teams start this setup by sharing a single admin login across all pipeline nodes. That broad role lets the app read or delete any table in the database. One bad prompt or code bug can wipe out production rows or expose private records.

How a native haystack cockroachdb connect setup works

CockroachDB speaks the standard Postgres wire protocol for client traffic. Because of this, Haystack components talk to the cluster using standard Postgres adapters. You start by creating a dedicated SQL user inside your database cluster. Next, you create a target database and grant table roles to that user. Your pipeline reads the host address, port, user name, and secret key at startup. TLS certificates check the server identity and encrypt traffic on the wire.

Inside the app, the document store holds text chunks and vector embeddings. When a user asks a question, the retriever node runs a search query. It sends a SQL read statement to the cluster and pulls back matching rows. Indexing pipelines do the reverse job during data loads. They take parsed files and run write statements to store new records. Pooling tools inside the worker keep database links open so queries run fast.

Managing database roles for pipeline workers

A clean setup splits indexing duties from search duties at the database level. Your indexing worker needs permission to insert and update rows in the document table. Your search worker only needs permission to read rows from that same table. Giving both workers the same broad role breaks the rule of least privilege. If an attacker tricks the search node, they should not gain write power.

Teams also isolate vector tables from core business tables using separate schemas. You grant the Haystack SQL role access to the document schema alone. This stops the pipeline from reading billing tables or user login records by mistake. You should also set limits on how many links the app can open. Good role design blocks broad accidents before the app even starts running.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native database roles solve and what they miss

Native database roles and network rules decide who can log in to the cluster. They check that the app has a valid key and comes from a known host. Table grants also block the worker from touching schemas outside its scope. These built-in checks form a strong base for your data setup.

Still, static grants cannot inspect what individual SQL statements do in flight. Once the pipeline logs in, the database trusts every query that fits the role. A permitted table might hold mixed data, including user emails or phone numbers. If a retrieval query pulls those rows, raw sensitive fields go straight to the model. Also, shared app keys make it hard to trace which end user triggered a query. Database logs only show the generic service account name on every line. Teams need a way to check queries and mask results as traffic flows.

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 standard Postgres components work for a haystack cockroachdb connect setup?

CockroachDB uses the Postgres wire protocol to handle client traffic and SQL commands. This allows standard Postgres document stores in Haystack to read and write data directly.

Should indexing and search pipelines share the same database role?

No, you should create two separate database roles for these tasks. Give the indexing role write rights, and limit the search role to read-only queries.

How can teams protect private fields stored inside document chunks?

Table roles only allow or block access to the whole table at once. To protect fields like card numbers or national IDs, rewrite matched fields in query results.

The query runs. The emails stay hidden.