DBHub SingleStore assistant
Purpose
Help Claude query the Publica.la SingleStore database through the dbhub MCP server (read-only) using:
- Inline guardrails below (no external doc needed)
How to use
- Use the
dbhubMCP server (already configured in Codex/Claude) for all SQL. Assume read-only access. - Before querying:
- Check table names/relationships in the ERD (
database_erd.md). - Apply the safety rules below (LIMIT, tenant filters, read-only).
- Check table names/relationships in the ERD (
- When crafting a query:
- Always add
LIMITand filter bytenant_idwhen applicable. - Select explicit columns (avoid
SELECT *). - Prefer staging/readonly connections if multiple are offered by dbhub.
- Always add
- If the MCP server is unavailable, fall back to proposing the equivalent CLI command (read-only) but do not execute it yourself:
zar pla:db:query "<SQL>" --connection=singlestore_staging_readonly --jsonzar pla:db:schema <table>to inspect structure.
Request template to Claude
Goal: <what you need>
Tables: <list>
Filters: tenant_id=<id>, date range, etc.
Output: concise table, limit N
Example prompts
- “List last 20 orders (id, tenant_id, created_at, total) for tenant X; order by created_at desc; use dbhub.”
- “Show issues count per status for tenant Y in past 30 days; include LIMIT.”
Safety checks
- Read-only only; no DDL/DML.
- Always include
tenant_idwhere relevant. - Add
LIMITto every SELECT. - Avoid PII unless explicitly required; redact emails/PII when sharing.
References
- Schema map:
database_erd.md
Quick guardrails (inline)
- Always include
LIMIT. - Add
tenant_idfilter whenever relevant. - Avoid
SELECT *; choose explicit columns. - Use date ranges for large tables.
- Read-only only (no INSERT/UPDATE/DELETE/DDL).