database
db.create
Create workspace database
Effects: write
Provision this workspace's own database (one per workspace). Returns the connection string and password ONCE — relay them to the user immediately; they cannot be retrieved later. Errors if the workspace already has a database. Use db.schema / db.query / db.execute to work with it afterwards.
Arguments
No arguments.
db.execute
Write to workspace database
Effects: write
Run SQL (CREATE TABLE / INSERT / UPDATE / DELETE / ALTER) against this workspace's own database. Use db.schema first to see what exists, and db.query to read.
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
sql | string | yes | SQL DDL/DML, e.g. CREATE TABLE records (id serial primary key, name text) |
db.query
Query workspace database
Effects: read
Read from this workspace's own database. Pass either a natural-language question (e.g. 'how many records were added this week') or a raw SQL SELECT. Read-only; returns rows plus a chart hint.
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
question | string | no | Natural-language question about the data |
sql | string | no | Raw SQL SELECT (alternative to question) |
db.schema
Workspace database schema
Effects: read
List the tables and columns of this workspace's own database. Call this before db.query or db.execute to learn what exists.
Arguments
No arguments.