Daita agents / guide
PostgreSQL
Attach selected PostgreSQL schemas with an explicit secret reference and execute bounded read-only queries.
#Credentials
Use a read-only database role and an explicit secret reference:
from daita.security import SecretReference
credential = SecretReference.environment("DAITA_POSTGRES_PASSWORD")The password is resolved only when Daita opens the source. It is never persisted in source configuration.
#Probe Schemas
Applications can inspect available non-system schemas before attachment:
probe = await agent.probe_postgresql(
host="db.example.com",
database="analytics",
username="daita_reader",
credential=credential,
ssl_mode="verify-full",
)
for schema in probe.schemas:
print(schema.name, schema.has_base_tables)The probe is bounded and does not persist a source registration.
#Attach
source = await agent.attach_postgresql(
host="db.example.com",
database="analytics",
username="daita_reader",
credential=credential,
schemas=("public", "reporting"),
port=5432,
ssl_mode="verify-full",
name="Analytics",
)Equivalent source-record form:
from daita import PostgreSQLSource
source = await agent.attach(
PostgreSQLSource(
host="db.example.com",
database="analytics",
username="daita_reader",
credential=credential,
schemas=("public", "reporting"),
ssl_mode="verify-full",
name="Analytics",
)
)Supported SSL modes are disable, prefer, allow, require, verify-ca, and verify-full.
#Discovery
Daita catalogs base tables, columns, supported types, indexes, primary keys, and foreign-key relationships from only the selected schemas. PostgreSQL system schemas are excluded.
#Query Boundary
data_query_postgresql runs inside a read-only transaction with a bounded statement timeout. Daita:
- revalidates SQL against current catalog facts;
- reconnects through the admitted source registration;
- rechecks live structure;
- applies row and byte bounds;
- rolls back the transaction; and
- returns a JSON-safe result projection.
Only a deliberately bounded set of SQL functions and supported PostgreSQL types is accepted. Server functions capable of external I/O are outside the public query surface.
#Headless Attachment
daita attach atlas postgresql \
--host db.example.com \
--database analytics \
--username daita_reader \
--password-env DAITA_POSTGRES_PASSWORD \
--schema public \
--schema reporting \
--ssl-mode verify-full \
--source-name Analytics