Skip to content

Commit 292cd39

Browse files
committed
docs
1 parent ea77790 commit 292cd39

File tree

4 files changed

+355
-1
lines changed

4 files changed

+355
-1
lines changed

apps/docs/components/ui/icon-mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ import {
105105
StagehandIcon,
106106
StripeIcon,
107107
SupabaseIcon,
108+
TableIcon,
108109
TavilyIcon,
109110
TelegramIcon,
110111
TranslateIcon,
@@ -228,6 +229,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
228229
stripe: StripeIcon,
229230
stt: STTIcon,
230231
supabase: SupabaseIcon,
232+
table: TableIcon,
231233
tavily: TavilyIcon,
232234
telegram: TelegramIcon,
233235
translate: TranslateIcon,

apps/docs/content/docs/en/tools/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"stripe",
102102
"stt",
103103
"supabase",
104+
"table",
104105
"tavily",
105106
"telegram",
106107
"translate",
Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,351 @@
1+
---
2+
title: Table
3+
description: User-defined data tables for storing and querying structured data
4+
---
5+
6+
import { BlockInfoCard } from "@/components/ui/block-info-card"
7+
8+
<BlockInfoCard
9+
type="table"
10+
color="#10B981"
11+
/>
12+
13+
Tables allow you to create and manage custom data tables directly within Sim. Store, query, and manipulate structured data within your workflows without needing external database integrations.
14+
15+
**Why Use Tables?**
16+
- **No external setup**: Create tables instantly without configuring external databases
17+
- **Workflow-native**: Data persists across workflow executions and is accessible from any workflow in your workspace
18+
- **Flexible schema**: Define columns with types (string, number, boolean, date, json) and constraints (required, unique)
19+
- **Powerful querying**: Filter, sort, and paginate data using MongoDB-style operators
20+
- **Agent-friendly**: Tables can be used as tools by AI agents for dynamic data storage and retrieval
21+
22+
**Key Features:**
23+
- Create tables with custom schemas
24+
- Insert, update, upsert, and delete rows
25+
- Query with filters and sorting
26+
- Batch operations for bulk inserts
27+
- Bulk updates and deletes by filter
28+
- Up to 10,000 rows per table, 100 tables per workspace
29+
30+
## Creating Tables
31+
32+
Tables are created from the **Tables** section in the sidebar. Each table requires:
33+
- **Name**: Alphanumeric with underscores (e.g., `customer_leads`)
34+
- **Description**: Optional description of the table's purpose
35+
- **Schema**: Define columns with name, type, and optional constraints
36+
37+
### Column Types
38+
39+
| Type | Description | Example Values |
40+
|------|-------------|----------------|
41+
| `string` | Text data | `"John Doe"`, `"active"` |
42+
| `number` | Numeric data | `42`, `99.99` |
43+
| `boolean` | True/false values | `true`, `false` |
44+
| `date` | Date/time values | `"2024-01-15T10:30:00Z"` |
45+
| `json` | Complex nested data | `{"address": {"city": "NYC"}}` |
46+
47+
### Column Constraints
48+
49+
- **Required**: Column must have a value (cannot be null)
50+
- **Unique**: Values must be unique across all rows (enables upsert matching)
51+
52+
## Usage Instructions
53+
54+
Create and manage custom data tables. Store, query, and manipulate structured data within workflows.
55+
56+
## Tools
57+
58+
### `table_query_rows`
59+
60+
Query rows from a table with filtering, sorting, and pagination
61+
62+
#### Input
63+
64+
| Parameter | Type | Required | Description |
65+
| --------- | ---- | -------- | ----------- |
66+
| `tableId` | string | Yes | Table ID |
67+
| `filter` | object | No | Filter conditions using MongoDB-style operators |
68+
| `sort` | object | No | Sort order as \{column: "asc"\|"desc"\} |
69+
| `limit` | number | No | Maximum rows to return \(default: 100, max: 1000\) |
70+
| `offset` | number | No | Number of rows to skip \(default: 0\) |
71+
72+
#### Output
73+
74+
| Parameter | Type | Description |
75+
| --------- | ---- | ----------- |
76+
| `success` | boolean | Whether query succeeded |
77+
| `rows` | array | Query result rows |
78+
| `rowCount` | number | Number of rows returned |
79+
| `totalCount` | number | Total rows matching filter |
80+
| `limit` | number | Limit used in query |
81+
| `offset` | number | Offset used in query |
82+
83+
### `table_insert_row`
84+
85+
Insert a new row into a table
86+
87+
#### Input
88+
89+
| Parameter | Type | Required | Description |
90+
| --------- | ---- | -------- | ----------- |
91+
| `tableId` | string | Yes | Table ID |
92+
| `data` | object | Yes | Row data as JSON object matching the table schema |
93+
94+
#### Output
95+
96+
| Parameter | Type | Description |
97+
| --------- | ---- | ----------- |
98+
| `success` | boolean | Whether row was inserted |
99+
| `row` | object | Inserted row data including generated ID |
100+
| `message` | string | Status message |
101+
102+
### `table_upsert_row`
103+
104+
Insert or update a row based on unique column constraints. If a row with matching unique field exists, update it; otherwise insert a new row.
105+
106+
#### Input
107+
108+
| Parameter | Type | Required | Description |
109+
| --------- | ---- | -------- | ----------- |
110+
| `tableId` | string | Yes | Table ID |
111+
| `data` | object | Yes | Row data to insert or update |
112+
113+
#### Output
114+
115+
| Parameter | Type | Description |
116+
| --------- | ---- | ----------- |
117+
| `success` | boolean | Whether row was upserted |
118+
| `row` | object | Upserted row data |
119+
| `operation` | string | Operation performed: "insert" or "update" |
120+
| `message` | string | Status message |
121+
122+
### `table_batch_insert_rows`
123+
124+
Insert multiple rows at once (up to 1000 rows per batch)
125+
126+
#### Input
127+
128+
| Parameter | Type | Required | Description |
129+
| --------- | ---- | -------- | ----------- |
130+
| `tableId` | string | Yes | Table ID |
131+
| `rows` | array | Yes | Array of row data objects to insert |
132+
133+
#### Output
134+
135+
| Parameter | Type | Description |
136+
| --------- | ---- | ----------- |
137+
| `success` | boolean | Whether batch insert succeeded |
138+
| `rows` | array | Array of inserted rows with IDs |
139+
| `insertedCount` | number | Number of rows inserted |
140+
| `message` | string | Status message |
141+
142+
### `table_update_row`
143+
144+
Update a specific row by its ID
145+
146+
#### Input
147+
148+
| Parameter | Type | Required | Description |
149+
| --------- | ---- | -------- | ----------- |
150+
| `tableId` | string | Yes | Table ID |
151+
| `rowId` | string | Yes | Row ID to update |
152+
| `data` | object | Yes | Data to update \(partial update supported\) |
153+
154+
#### Output
155+
156+
| Parameter | Type | Description |
157+
| --------- | ---- | ----------- |
158+
| `success` | boolean | Whether row was updated |
159+
| `row` | object | Updated row data |
160+
| `message` | string | Status message |
161+
162+
### `table_update_rows_by_filter`
163+
164+
Update multiple rows matching a filter condition
165+
166+
#### Input
167+
168+
| Parameter | Type | Required | Description |
169+
| --------- | ---- | -------- | ----------- |
170+
| `tableId` | string | Yes | Table ID |
171+
| `filter` | object | Yes | Filter to match rows for update |
172+
| `data` | object | Yes | Data to apply to matching rows |
173+
| `limit` | number | No | Maximum rows to update \(default: 1000\) |
174+
175+
#### Output
176+
177+
| Parameter | Type | Description |
178+
| --------- | ---- | ----------- |
179+
| `success` | boolean | Whether update succeeded |
180+
| `updatedCount` | number | Number of rows updated |
181+
| `updatedRowIds` | array | IDs of updated rows |
182+
| `message` | string | Status message |
183+
184+
### `table_delete_row`
185+
186+
Delete a specific row by its ID
187+
188+
#### Input
189+
190+
| Parameter | Type | Required | Description |
191+
| --------- | ---- | -------- | ----------- |
192+
| `tableId` | string | Yes | Table ID |
193+
| `rowId` | string | Yes | Row ID to delete |
194+
195+
#### Output
196+
197+
| Parameter | Type | Description |
198+
| --------- | ---- | ----------- |
199+
| `success` | boolean | Whether row was deleted |
200+
| `deletedCount` | number | Number of rows deleted \(1 or 0\) |
201+
| `message` | string | Status message |
202+
203+
### `table_delete_rows_by_filter`
204+
205+
Delete multiple rows matching a filter condition
206+
207+
#### Input
208+
209+
| Parameter | Type | Required | Description |
210+
| --------- | ---- | -------- | ----------- |
211+
| `tableId` | string | Yes | Table ID |
212+
| `filter` | object | Yes | Filter to match rows for deletion |
213+
| `limit` | number | No | Maximum rows to delete \(default: 1000\) |
214+
215+
#### Output
216+
217+
| Parameter | Type | Description |
218+
| --------- | ---- | ----------- |
219+
| `success` | boolean | Whether delete succeeded |
220+
| `deletedCount` | number | Number of rows deleted |
221+
| `deletedRowIds` | array | IDs of deleted rows |
222+
| `message` | string | Status message |
223+
224+
### `table_get_row`
225+
226+
Get a single row by its ID
227+
228+
#### Input
229+
230+
| Parameter | Type | Required | Description |
231+
| --------- | ---- | -------- | ----------- |
232+
| `tableId` | string | Yes | Table ID |
233+
| `rowId` | string | Yes | Row ID to retrieve |
234+
235+
#### Output
236+
237+
| Parameter | Type | Description |
238+
| --------- | ---- | ----------- |
239+
| `success` | boolean | Whether row was found |
240+
| `row` | object | Row data |
241+
| `message` | string | Status message |
242+
243+
### `table_get_schema`
244+
245+
Get the schema definition for a table
246+
247+
#### Input
248+
249+
| Parameter | Type | Required | Description |
250+
| --------- | ---- | -------- | ----------- |
251+
| `tableId` | string | Yes | Table ID |
252+
253+
#### Output
254+
255+
| Parameter | Type | Description |
256+
| --------- | ---- | ----------- |
257+
| `success` | boolean | Whether schema was retrieved |
258+
| `name` | string | Table name |
259+
| `columns` | array | Array of column definitions |
260+
| `message` | string | Status message |
261+
262+
## Filter Operators
263+
264+
Filters use MongoDB-style operators for flexible querying:
265+
266+
| Operator | Description | Example |
267+
|----------|-------------|---------|
268+
| `$eq` | Equals | `{"status": {"$eq": "active"}}` or `{"status": "active"}` |
269+
| `$ne` | Not equals | `{"status": {"$ne": "deleted"}}` |
270+
| `$gt` | Greater than | `{"age": {"$gt": 18}}` |
271+
| `$gte` | Greater than or equal | `{"score": {"$gte": 80}}` |
272+
| `$lt` | Less than | `{"price": {"$lt": 100}}` |
273+
| `$lte` | Less than or equal | `{"quantity": {"$lte": 10}}` |
274+
| `$in` | In array | `{"status": {"$in": ["active", "pending"]}}` |
275+
| `$nin` | Not in array | `{"type": {"$nin": ["spam", "blocked"]}}` |
276+
| `$contains` | String contains | `{"email": {"$contains": "@gmail.com"}}` |
277+
278+
### Combining Filters
279+
280+
Multiple field conditions are combined with AND logic:
281+
282+
```json
283+
{
284+
"status": "active",
285+
"age": {"$gte": 18}
286+
}
287+
```
288+
289+
Use `$or` for OR logic:
290+
291+
```json
292+
{
293+
"$or": [
294+
{"status": "active"},
295+
{"status": "pending"}
296+
]
297+
}
298+
```
299+
300+
## Sort Specification
301+
302+
Specify sort order with column names and direction:
303+
304+
```json
305+
{
306+
"createdAt": "desc"
307+
}
308+
```
309+
310+
Multi-column sorting:
311+
312+
```json
313+
{
314+
"priority": "desc",
315+
"name": "asc"
316+
}
317+
```
318+
319+
## Built-in Columns
320+
321+
Every row automatically includes:
322+
323+
| Column | Type | Description |
324+
|--------|------|-------------|
325+
| `id` | string | Unique row identifier |
326+
| `createdAt` | date | When the row was created |
327+
| `updatedAt` | date | When the row was last modified |
328+
329+
These can be used in filters and sorting.
330+
331+
## Limits
332+
333+
| Resource | Limit |
334+
|----------|-------|
335+
| Tables per workspace | 100 |
336+
| Rows per table | 10,000 |
337+
| Columns per table | 50 |
338+
| Max row size | 100KB |
339+
| String value length | 10,000 characters |
340+
| Query limit | 1,000 rows |
341+
| Batch insert size | 1,000 rows |
342+
| Bulk update/delete | 1,000 rows |
343+
344+
## Notes
345+
346+
- Category: `blocks`
347+
- Type: `table`
348+
- Tables are scoped to workspaces and accessible from any workflow within that workspace
349+
- Data persists across workflow executions
350+
- Use unique constraints to enable upsert functionality
351+
- The visual filter/sort builder provides an easy way to construct queries without writing JSON

apps/sim/blocks/blocks/table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export const TableBlock: BlockConfig<TableQueryResponse> = {
177177
description: 'User-defined data tables',
178178
longDescription:
179179
'Create and manage custom data tables. Store, query, and manipulate structured data within workflows.',
180-
docsLink: 'https://docs.sim.ai/tools/table',
180+
docsLink: 'https://docs.simstudio.ai/tools/table',
181181
category: 'blocks',
182182
bgColor: '#10B981',
183183
icon: TableIcon,

0 commit comments

Comments
 (0)