Run a read-only SQL query
execute_sqlRun one read-only PostgreSQL SELECT over the account's TrendsAGI data (tables from read_data_schema: trends, trend_snapshots, trend_categories, trend_insights, watchlist, recommendations, crisis_events). Use for questions that need filtering, joins or aggregation. Returns columns and rows; results stop at max_rows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | One SELECT (WITH ... SELECT is fine), e.g. SELECT name, volume, growth_pct FROM trends WHERE last_seen_at > now() - interval '24 hours' ORDER BY velocity_per_hour DESC NULLS LAST LIMIT 20. | |
| max_rows | No | Most rows to return (1-200). |