Skip to main content
Table Workshop is the write-side counterpart to Database Queries. While Database Queries reads and analyzes data, Table Workshop creates new tables, modifies structure, edits data, and merges tables together.

Quick Start

import requests

response = requests.post(
    "https://api.zarkai.xyz/v1/chat",
    headers={
        "x-api-key": "your_api_key",
        "Content-Type": "application/json",
    },
    json={
        "messages": [
            {"role": "user", "content": "Create a table with 100 sample customer orders including name, product, amount, and date"}
        ],
        "workspace_id": "wks-xxxxx",
        "tools": ["table_workshop"],
        "tool_choice": "auto",
    },
)

data = response.json()
print(data["response"])

Operations

OperationDescriptionExample prompt
Create tableBuild new tables from descriptions or code”Create a table of the 50 US states with population and capital”
Add columnAdd new columns with optional computed values”Add a profit_margin column calculated as (revenue - cost) / revenue”
Remove columnDrop columns from a table”Remove the internal_notes column”
Rename columnChange column names”Rename ‘amt’ to ‘amount‘“
Change typeConvert column data types”Change the date column to datetime”
Insert rowsAdd new rows of data”Add a row for product XYZ with price $49.99”
Delete rowsRemove rows matching criteria”Delete all rows where status is ‘cancelled‘“
Update rowsModify existing values”Set status to ‘archived’ for all orders before 2023”
Find & replaceReplace values across a column”Replace all ‘N/A’ with null”
Computed columnsApply formulas or expressions”Add a column that calculates price * quantity”
Merge tablesJoin, combine, or merge multiple tables”Merge sales and inventory on product_id”
Copy dataCopy data between tables”Copy the first 100 rows to a new table”

Merging Tables

For merge, join, and combine operations, a single Table Workshop task handles everything. If you don’t specify which tables to merge, Table Workshop lists available tables and asks you to choose:
{
  "messages": [
    {"role": "user", "content": "Merge my sales and inventory tables"}
  ],
  "workspace_id": "wks-xxxxx",
  "tools": ["table_workshop"],
  "tool_choice": "auto"
}
Supported join types: inner join, left join, right join, full outer join, and union (append rows).

Streaming

Python
import requests
import json

response = requests.post(
    "https://api.zarkai.xyz/v1/chat",
    headers={"x-api-key": "your_api_key", "Content-Type": "application/json"},
    json={
        "messages": [{"role": "user", "content": "Add a profit_margin column to my sales table"}],
        "workspace_id": "wks-xxxxx",
        "tools": ["table_workshop"],
        "stream": True,
    },
    stream=True,
)

for line in response.iter_lines():
    if line:
        event = json.loads(line.decode("utf-8").removeprefix("data: "))
        if event["type"] == "table":
            print(f"Table updated: {event['display_name']}")
        elif event["type"] == "ai_chunk":
            print(event["content"], end="", flush=True)
        elif event["type"] == "ai_complete":
            print("\n\nDone.")

Streaming Events

EventDescription
tablePreview of the new or modified table data
ai_chunkDescription of what was changed
ai_completeFinal response with operation summary

When to Use Table Workshop vs Other Tools

Want to…Use
Query or filter existing dataDatabase Queries
Add/remove columns, merge, edit rowsTable Workshop
Run statistical analysis or simulationsCode Runner
Generate a table from computations and save itCode Runner

Examples

Create a table of the 50 US states with population and capital city
Add a "profit_margin" column calculated as (revenue - cost) / revenue
Remove the "internal_notes" column from the customer table
Find and replace all instances of "N/A" with null
Merge my sales and inventory tables on product_id
Combine all my tables into one
Split this table into two: one for domestic orders, one for international