Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt

Use this file to discover all available pages before exploring further.

PostgresResource connects to a Postgres database via a DSN and exposes its schemas and tables as a tree the agent can list, read, and grep.

Config

from mirage.resource.postgres import PostgresConfig, PostgresResource

resource = PostgresResource(PostgresConfig(
    dsn="postgres://user:pass@host:5432/db?sslmode=require",
    schemas=["public", "analytics"],   # optional allowlist
    default_row_limit=1000,
    max_read_rows=10_000,
    max_read_bytes=10 * 1024 * 1024,
    default_search_limit=100,
))
FieldDefaultNotes
dsnrequiredPostgres connection string. Redacted in snapshots.
schemasNoneOptional list to limit which schemas appear in the tree.
default_row_limit1000Default LIMIT applied to ad-hoc reads.
max_read_rows10_000Hard ceiling per read.
max_read_bytes10 MiBHard ceiling per read.
default_search_limit100Default LIMIT for search-style queries.
For DSN format and permissions, see Postgres Setup.

Mount mode

read only. Postgres mounts are read-only at the resource level.

Snapshot behavior

The DSN is redacted on snapshot. Loading a snapshot back requires an override config that supplies a fresh DSN.