Run a Query
Use this page after onequery source list shows the source you connected.
Confirm Context
Section titled “Confirm Context”onequery config get api.server_urlonequery auth whoamionequery source listExecute a Smoke Query
Section titled “Execute a Smoke Query”onequery query exec --source postgres://warehouse --sql "select 1"Query Application Data
Section titled “Query Application Data”onequery query exec \ --source postgres://warehouse \ --sql "select id, email, created_at from users order by created_at desc limit 20"Warehouse Example
Section titled “Warehouse Example”onequery query exec \ --source snowflake://analytics_prod \ --sql "select count(*) as events from analytics.events where event_date >= current_date - 1"Query Rules
Section titled “Query Rules”- Keep queries read-only.
- Ask for the smallest result set needed.
- Use explicit columns instead of
select *for agent workflows. - Include time windows for logs, events, and analytics tables.
- Prefer source-specific read replicas or service users for production data.
When a Query Fails
Section titled “When a Query Fails”Check these in order:
- Confirm the source exists:
onequery source list. - Confirm the CLI is pointed at the expected server:
onequery config get api.server_url. - Confirm your session and organization:
onequery auth whoami. - Retry the smoke query:
onequery query exec --source postgres://warehouse --sql "select 1". - Check that the SQL is read-only and valid for the provider dialect.