Skip to main content
The Transformation class is the SDK surface for VectorShift’s stored Python functions. Define a function once — its source, typed inputs, and typed outputs live on the platform — then run it directly from Python, or drop it into a Pipeline as a TransformationNode.
Prerequisites: Installed SDK · API key set · Python 3.10+.

Mental model

  • A transformation is a named Python function plus a typed I/O schema. The function source is stored as a string; inputs / outputs map each name to an IOType (optionally wrapped in IOConfig for a description).
  • Two ways to create one:
    • ImperativeTransformation.new(name, function=…, inputs=…, outputs=…), passing the source as a string.
    • Decorator@Transformation.from_function() over a real Python function. The SDK reads the source, infers the schema from type hints, and upserts it by name (idempotent: fetch-by-name → update-if-changed → create).
  • Run it with t.run(inputs={…}), which blocks on the engine and returns a typed TransformationRunResult with .status, .outputs, and an optional .error.
  • Or compose it into a Pipeline via TransformationNode(transformation=t.id, …), wiring each declared input to an upstream node output.
  • Every method has an async sibling (anew, afetch, arun, aupdate, …).

Quick start

From a Python function

The @Transformation.from_function() decorator is the ergonomic path — write a normal function, let the SDK infer the schema and upload the source:
Input types come from parameter annotations; output keys come from the return annotation (a TypedDict, a literal return {…} dict, or a single result). The decorator is idempotent under name, so re-running your script updates the stored function only when the source or schema changed. See the from-function example.

Ways to use a transformation

What’s next

Reference

Every public method, type, and enum.

CRUD example

The full create / fetch / list / update / delete lifecycle.

From a function

Decorate a Python function and let the SDK infer the schema.