bt sql opens an interactive editor with query history. Pass a query directly or pipe from stdin for scripting.
bt switch, --project, or BRAINTRUST_DEFAULT_PROJECT, use FROM logs as shorthand for that project’s logs. bt resolves the project and replaces the shorthand with project_logs('<project-id>') before sending the query. Use project_logs('<project-name-or-id>') when the query should name a project directly instead of using the selected context.
Interactive controls
Query syntax
- A
FROMclause is required (logs,project_logs(...),experiment(...), ordataset(...)) FROM logsrequires a selected project- Prefer filtering with
WHERE; useHAVINGonly after aggregation - Joins, subqueries, unions, and window functions are not supported
- Use explicit column aliases and type casts for clarity
- Paginate large results with
OFFSET '<cursor_token>'