create_table
Create a local table in a SAP Datasphere space with defined columns, primary keys, and deployment options. Supports provisioning for data ingestion, staging, or modelling.
Instructions
Create a new local table in a SAP Datasphere space.
IMPORTANT: This is a HIGH-RISK, WRITE operation. It creates a design-time object and (optionally) deploys it, which changes the state of the tenant. Requires user consent.
Use this tool when:
User asks: "Lege eine Tabelle X in Space Y an" / "Create a table for orders in DIMITRITEST"
Provisioning new local tables for data ingestion, staging, or modelling
Bootstrapping schemas from a specification (name + columns)
What it does:
Builds a Datasphere object definition (CSN-style JSON) from your column list
Writes it to a temporary file
Calls the Datasphere CLI:
datasphere objects local-tables create --space <id> --file-path <def.json>(the table name comes from thedefinitionskey in the JSON, not from a flag)The CLI deploys the object by default so it becomes queryable;
deploy=falseadds--no-deployReturns the created table metadata
Required parameters:
space_id: Target space (must exist, uppercase, e.g., 'DIMITRITEST')
table_name: Technical name (uppercase, alphanumeric + underscore, e.g., 'BESTELLUNGEN')
columns: Array of column definitions
Column definition format:
{
"name": "BESTELL_ID", // required, uppercase
"type": "NVARCHAR", // required: NVARCHAR|VARCHAR|INTEGER|BIGINT|DECIMAL|DOUBLE|DATE|TIMESTAMP|BOOLEAN|NCLOB
"length": 20, // for NVARCHAR/VARCHAR
"precision": 15, // for DECIMAL
"scale": 2, // for DECIMAL
"nullable": false, // default true
"description": "Order ID" // optional
}Optional parameters:
primary_keys: Array of column names that form the primary key (e.g., ["BESTELL_ID"])
label: Business-friendly display name (e.g., "Bestellungen")
description: Description of the table's business purpose
deploy: If true (default), deploy the table immediately after creation so it can be queried
Example call (Bestellungen):
{
"space_id": "DIMITRITEST",
"table_name": "BESTELLUNGEN",
"label": "Bestellungen",
"description": "Kundenbestellungen mit Positionen",
"primary_keys": ["BESTELL_ID"],
"columns": [
{"name": "BESTELL_ID", "type": "NVARCHAR", "length": 20, "nullable": false},
{"name": "KUNDEN_ID", "type": "NVARCHAR", "length": 20, "nullable": false},
{"name": "BESTELLDATUM", "type": "DATE"},
{"name": "PRODUKT_ID", "type": "NVARCHAR", "length": 20},
{"name": "MENGE", "type": "INTEGER"},
{"name": "EINZELPREIS", "type": "DECIMAL", "precision": 15, "scale": 2},
{"name": "GESAMTBETRAG", "type": "DECIMAL", "precision": 15, "scale": 2},
{"name": "WAEHRUNG", "type": "NVARCHAR", "length": 3},
{"name": "STATUS", "type": "NVARCHAR", "length": 20}
],
"deploy": true
}Prerequisites (real mode):
Datasphere CLI installed and available on PATH (
datasphere --version)User logged in to the CLI (
datasphere login)User has DW Space Administrator or Modeler role in the target space
Mock mode (USE_MOCK_DATA=true):
No CLI call is made
Returns a simulated success response with the generated object definition
Perfect for testing prompts before running against a real tenant
Security & Safety:
Table name is validated to prevent injection (must match ^[A-Z][A-Z0-9_]*$)
Column names are validated identically
Data types are checked against a whitelist
HIGH-RISK: requires consent, all actions are audit-logged
Idempotency: fails if the table already exists (use datasphere objects local-tables update / delete first)
Note: Corresponds to CLI: datasphere objects local-tables create --space <id> --file-path <def.json> [--no-deploy]
Only local tables. This is the one object type the server creates, because the payload is derived from data it has already read. Views, analytic models, flows, task chains, spaces, users and roles are CLI territory — see docs/MCP_VS_CLI.md. Do not try to reshape this tool's CSN into another type.
Canonical CSN shape: the generated definition follows
examples/local-table-orders.json and Appendix E of the datasphere-cli skill
(DataphereCLI repo). That example is not just a reference — tests/test_csn_shape.py
derives this tool's arguments from it and compares the result back, so the two
cannot drift apart. If the CLI ever rejects the payload, compare against the
example rather than guessing.
Column names must be UPPERCASE (^[A-Z][A-Z0-9_]*$). The minimal SAP Help
example uses a mixed-case Name, which this tool rejects on purpose: uppercase
matches the Open SQL schema convention and needs no quoting in later queries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | Business-friendly display label (e.g., 'Bestellungen'). | |
| deploy | No | If true (default), deploy the table immediately after creation so it can be queried. | |
| columns | Yes | Column definitions. Each entry: {name, type, [length], [precision], [scale], [nullable], [description]}. | |
| space_id | Yes | Target space ID in UPPERCASE (e.g., 'DIMITRITEST', 'SALES_ANALYTICS'). | |
| table_name | Yes | Technical table name (uppercase, alphanumeric + underscore). Must match ^[A-Z][A-Z0-9_]*$. | |
| description | No | Business description of the table's purpose. | |
| primary_keys | No | List of column names forming the primary key (e.g., ['BESTELL_ID']). |