Transformation is a named Python function stored on the platform, with a typed input / output schema. Create one imperatively with Transformation.new(...) or declaratively with the @Transformation.from_function decorator; run it with run or wire it into a Pipeline as a TransformationNode. Every method has an async sibling prefixed with a.
Lifecycle
new
Returns
save
save alternative to new). Populates .id on the instance.
fetch
id or name (at least one is required). username / org_name disambiguate a shared transformation. Raises TransformationNotFound if nothing matches.
list
include_shared=True to include shared ones, verbose=True to populate full TransformationListEntry fields (otherwise only ids come back). Returns a TransformationList.
update
_UNSET sentinel distinguishes “not supplied” from an explicit None). Mutates the local instance to match. Returns self.
delete
From a Python function
from_function
Transformation. Must be called with parentheses — @Transformation.from_function() (or with keyword arguments). The decorated name then binds to the resulting Transformation instance, so .id, .run(...), and .inputs resolve on it. The bare form @Transformation.from_function (no parens) passes your function as the name argument and yields a decorator, not a Transformation.
- Source — the function body is captured via
inspect.getsource(decorator lines stripped) and stored asfunction. - Name / description — default to the function’s
__name__and docstring. - Schema inference —
inputscome from parameter type annotations;outputsfrom the return annotation. ATypedDictreturn maps each key to its type; a literalreturn {…}uses its string keys; anything else becomes a singleresult. Types map viaIOType.from_python. Pass explicitinputs=/outputs=to override. - Idempotency — by default the decorator fetches by
name, and updates only if the source or schema changed, otherwise creates. Returns the resultingTransformation. defer=True— skip the network call and return an unsavedTransformationyou can.save()later.
Running
run
inputs schema, input keys are validated against it — unknown keys raise TransformationInvalidSchema before any request is made. A schemaless instance (e.g. one constructed by id without a fetch) skips this check. A failed engine run raises TransformationRunFailed.
Returns
Typed
TransformationRunResult — .status, .outputs (native Python values, unwrapped from the engine’s DataType envelope), and an optional .error.Instance attributes
ATransformation carries: id, name, description, function_name, inputs, outputs, function, branch_id, version.
Types
IOConfig
A single input / output schema entry. On create / update the wire keeps only io_type; fetch returns the full object.
See
IOType.TransformationRunResult
"success" or "failure" — see TransformationStatus.TransformationListEntry
Plus user_id, org_id, username, email when verbose=True.
TransformationList
Enums
IOType
Wire vocabulary for input / output types:
IOType.from_python(annotation) maps a Python type annotation to the matching member, defaulting to ANY.
TransformationStatus
SUCCESS ("success") · FAILURE ("failure")
Errors
All subclassTransformationError, which subclasses VectorshiftError.
TransformationNotFound— afetchreturned no result.TransformationAmbiguousName—from_functionfound more than one transformation by name.TransformationRunFailed— a run completed with a failed status; carries.transformation_idand.message.TransformationInvalidSchema— wrong keys, unknownio_type, or unknown input keys passed torun.TransformationCompileError— the engine refused the Python source.
What’s next
Overview
Mental model and quick start.
Run & I/O types
Typed inputs, run results, and IOType mapping.
Pipeline node
Wire a Transformation into a Pipeline.
