Skip to content
Get started

Labric Write Api

tools.write(ToolWriteParams**kwargs) -> ToolWriteResponse
post/api/v1/tools/write

Write records to a table.

Inserts or updates records in the specified target table. Supports batch inserts, upserts with match columns, default value functions (DATETIME_NOW, UUID4), and optional dry-run validation. A job execution is created automatically if one is not provided.

ParametersExpand Collapse
data: Iterable[Dict[str, object]]

List of record dicts to write.

mode: str

Write mode (e.g. 'create', 'create-or-update').

target_name: str

The name of the table to write to.

target_type: Literal["table", "core-table"]

The type of target. Currently 'table' or 'core-table'.

Accepts one of the following:
"table"
"core-table"
batch_insert_ok: Optional[bool]

If True, allow batch insert of multiple records.

collect_output: Optional[bool]

If True, return the written records in the response.

defaults: Optional[Dict[str, str]]

Map of field names to default function names (e.g. 'DATETIME_NOW', 'UUID4').

dry_run: Optional[bool]

If True, resolve references, check table and column validity, and return the execution plan without committing changes.

job_execution_id: Optional[str]

Existing job execution ID to associate with this write. If omitted, a new one is created.

formatuuid
job_name: Optional[str]

Name for the auto-created job. Defaults to 'Off-Platform Manual Job'.

params_to_match_for_update: Optional[SequenceNotStr[str]]

Column names to match on when updating existing records.

ReturnsExpand Collapse
ToolWriteResponse = List[Dict[str, object]]
Labric Write Api
from labric import Labric

client = Labric(
    api_key="My API Key",
)
response = client.tools.write(
    data=[{
        "foo": "bar"
    }],
    mode="mode",
    target_name="target_name",
    target_type="table",
)
print(response)
[
  {
    "foo": "bar"
  }
]
Returns Examples
[
  {
    "foo": "bar"
  }
]