Skip to main content

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

  1. Use the dbhub MCP server (already configured in Codex/Claude) for all SQL. Assume read-only access.
  2. Before querying:
    • Check table names/relationships in the ERD (database_erd.md).
    • Apply the safety rules below (LIMIT, tenant filters, read-only).
  3. When crafting a query:
    • Always add LIMIT and filter by tenant_id when applicable.
    • Select explicit columns (avoid SELECT *).
    • Prefer staging/readonly connections if multiple are offered by dbhub.
  4. 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 --json
    • zar 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_id where relevant.
  • Add LIMIT to every SELECT.
  • Avoid PII unless explicitly required; redact emails/PII when sharing.

References

Quick guardrails (inline)

  • Always include LIMIT.
  • Add tenant_id filter whenever relevant.
  • Avoid SELECT *; choose explicit columns.
  • Use date ranges for large tables.
  • Read-only only (no INSERT/UPDATE/DELETE/DDL).