join_datasets
Join two indexed datasets on shared columns to combine data via SQL JOIN. Supports inner, left, right, and cross joins with column projection and row limits.
Instructions
Join two indexed datasets via SQL JOIN. Uses ATTACH DATABASE to combine two SQLite stores into one query. Supports inner, left, right, and cross joins. Use columns_a/columns_b to project — reduces tokens on wide tables. Row limit capped at 500. Prefer aggregate() on join results for summaries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max rows returned (default 50, hard cap 500) | |
| offset | No | Pagination offset (default 0) | |
| order_by | No | Column to sort results by | |
| columns_a | No | Columns to select from dataset_a (default: first 30) | |
| columns_b | No | Columns to select from dataset_b (default: first 30) | |
| dataset_a | Yes | First dataset identifier (left side of join) | |
| dataset_b | Yes | Second dataset identifier (right side of join) | |
| filters_a | No | Pre-filter dataset_a rows (same syntax as get_rows filters) | |
| filters_b | No | Pre-filter dataset_b rows (same syntax as get_rows filters) | |
| join_type | No | Join type (default 'inner') | inner |
| order_dir | No | Sort direction (default 'asc') | asc |
| join_column_a | Yes | Column from dataset_a to join on | |
| join_column_b | Yes | Column from dataset_b to join on |