Skip to content

Commit d026560

Browse files
authored
improvement(table): document that a column selection matching no column returns empty row data (#9915)
1 parent 222ba07 commit d026560

6 files changed

Lines changed: 17 additions & 21 deletions

File tree

‎apps/docs/content/docs/integrations/table.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Query rows with a typed predicate filter and cursor pagination. A single filter
217217
| --------- | ---- | -------- | ----------- |
218218
| `tableId` | string | Yes | Table ID in the execution workspace. In a workflow, the table must belong to the same workspace as the workflow. |
219219
| `filter` | json | No | Predicate condition, e.g. `\{"field":"wins","op":"gte","value":10\}`. Use `all` or `any` for multiple conditions; omit to match all rows. |
220-
| `columns` | array | No | Stable column IDs or table column names to include in each row data object. Omit or pass an empty array to return all columns. A reference that matches no column is ignored. |
220+
| `columns` | array | No | Stable column IDs or table column names to include in each row data object. Omit or pass an empty array to return all columns. A reference that matches no column is ignored; if none match, each row's data is empty. |
221221
| `order` | json | No | Sort spec, e.g. `\[\{"field":"wins","direction":"desc"\}\]`. |
222222
| `limit` | number | No | Maximum rows per page. Omit to return the entire matching result — fails if it exceeds the fixed 5 MiB row-data budget. With a limit, pages may byte-cut early and set nextCursor when more remain. |
223223
| `cursor` | string | No | Opaque pagination cursor returned by a prior query. Omit for the first page. |

‎apps/sim/lib/api/contracts/tables.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ const rowColumnSelectionSchema = z
797797
)
798798
.optional()
799799
.describe(
800-
'Stable column identifiers or column names to include. Omit or pass an empty array for all columns; a reference that matches no column is ignored.'
800+
"Stable column identifiers or column names to include. Omit or pass an empty array for all columns; a reference that matches no column is ignored, and if none match, each row's data is empty."
801801
)
802802

803803
/** Unrefined base so v1 contracts can `.extend()` — consumers use {@link tableRowsQuerySchema}. */

‎apps/sim/tools/generated/tool-metadata.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/sim/tools/table/params.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ export const TABLE_ID_PARAM = {
77
'Table ID in the execution workspace. In a workflow, the table must belong to the same workspace as the workflow.',
88
visibility: 'user-only',
99
} satisfies ToolConfig['params'][string]
10+
11+
/** Column projection for the row-query tools; shared so both query tools describe it identically. */
12+
export const TABLE_COLUMNS_PARAM = {
13+
type: 'array',
14+
required: false,
15+
items: { type: 'string' },
16+
description:
17+
"Stable column IDs or table column names to include in each row data object. Omit or pass an empty array to return all columns. A reference that matches no column is ignored; if none match, each row's data is empty.",
18+
visibility: 'user-or-llm',
19+
} satisfies ToolConfig['params'][string]

‎apps/sim/tools/table/query_rows.ts‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { enrichTableToolSchema } from '@/tools/schema-enrichers'
2-
import { TABLE_ID_PARAM } from '@/tools/table/params'
2+
import { TABLE_COLUMNS_PARAM, TABLE_ID_PARAM } from '@/tools/table/params'
33
import { tableSuccess } from '@/tools/table/response'
44
import type { TableQueryResponse, TableRowQueryParams } from '@/tools/table/types'
55
import type { InternalToolConfig } from '@/tools/types'
@@ -31,14 +31,7 @@ export const tableQueryRowsTool: InternalToolConfig<TableRowQueryParams, TableQu
3131
description: 'Sort order as {field: "asc"|"desc"}',
3232
visibility: 'user-or-llm',
3333
},
34-
columns: {
35-
type: 'array',
36-
required: false,
37-
items: { type: 'string' },
38-
description:
39-
'Stable column IDs or table column names to include in each row data object. Omit or pass an empty array to return all columns. A reference that matches no column is ignored.',
40-
visibility: 'user-or-llm',
41-
},
34+
columns: TABLE_COLUMNS_PARAM,
4235
limit: {
4336
type: 'number',
4437
required: false,

‎apps/sim/tools/table/query_rows_v2.ts‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { normalizeTablePredicate } from '@/lib/table/query-builder/predicate'
22
import { validatePredicateShape } from '@/lib/table/query-builder/validate'
33
import { enrichTableToolSchema } from '@/tools/schema-enrichers'
4-
import { TABLE_ID_PARAM } from '@/tools/table/params'
4+
import { TABLE_COLUMNS_PARAM, TABLE_ID_PARAM } from '@/tools/table/params'
55
import { tableSuccess } from '@/tools/table/response'
66
import type { TableQueryV2Response, TableRowQueryV2Params } from '@/tools/table/types'
77
import type { InternalToolConfig } from '@/tools/types'
@@ -44,14 +44,7 @@ export const tableQueryRowsV2Tool: InternalToolConfig<TableRowQueryV2Params, Tab
4444
'Predicate condition, e.g. `{"field":"wins","op":"gte","value":10}`. Use `all` or `any` for multiple conditions; omit to match all rows.',
4545
visibility: 'user-or-llm',
4646
},
47-
columns: {
48-
type: 'array',
49-
required: false,
50-
items: { type: 'string' },
51-
description:
52-
'Stable column IDs or table column names to include in each row data object. Omit or pass an empty array to return all columns. A reference that matches no column is ignored.',
53-
visibility: 'user-or-llm',
54-
},
47+
columns: TABLE_COLUMNS_PARAM,
5548
order: {
5649
type: 'json',
5750
required: false,

0 commit comments

Comments
 (0)