Query
Ask your data questions — read-only SQL, counts and sums per group, charts, and exports.
Four ways to get numbers and rows out, each open to every member, with the read scope for agents.
SQL console
SQL console in the sidebar (/<workspace>/sql) runs SQL against a data source you pick. Your objects are its tables, your fields their columns.
- One statement that reads:
SELECT,WITH,VALUES,TABLE,EXPLAINorSHOW. Run, or ⌘↵ / Ctrl+↵. - It runs in a
READ ONLYtransaction that always rolls back, on a connection of its own, as the data source's role: what that role can't read, the console can't either. - Read-only · stops after 30 s. At most 1,000 rows and 10,000 characters per cell; a bigger result is cut, and says so. Times are in UTC.
- An error shows Postgres's message and SQLSTATE and, where Postgres says, the line and column, with a caret under the spot, which the editor selects.
- A result names its source, its rows and its time; while a run goes, the last result stays, dimmed.
- Your draft stays in this browser, per workspace. Export saves the result as CSV or JSON.
- 60 queries per person per minute.
Agents run the same with sql_query (50 rows unless they ask for more; the API's sql.query, 200).
Aggregates
records_aggregate (the API's records.aggregate) counts and measures an object's records without SQL, with the same filters as a view:
- Group by up to 2 fields; a date groups by day, week, month, quarter or year.
- Measure up to 5:
count, orsum,avg,min,maxof a number (minandmaxof a date too). - Up to 500 groups (100 by default), sorted by group or by the first measure;
truncatedsays there were more.
{
"workspace": "acme-k3x9q0",
"object": "deals",
"groupBy": [{ "attributeId": "stage" }],
"measures": [{ "fn": "count" }, { "fn": "sum", "attributeId": "amount" }]
}The copilot uses it for "how many" and "how much" questions.
Charts
A Chart view shows an object's records grouped and measured: pick Chart (bar, line, area or pie), Group by a field (text, number, currency, rating, checkbox, date, timestamp, select, email, phone, URL or reference), and Measure: a count, or the sum, average, minimum or maximum Of a number field. Its filters are the view's. Owners and admins add a chart view; anyone can switch a view to a chart for themselves (Change to in its tab's menu), or ask the copilot ("chart deals by stage").
Workspace plugins chart the same way, with the chart and aggregateStat nodes (Plugins).
Export
Export on a table view saves the view's records (its filters and sorts, its fields) as CSV or JSON, up to 50,000 records. It's built in your browser, page by page; Stop the export cancels it.