- Each pipeline should have a unique alias and should be defined in the different files.
- A pipeline should have at least one transform function.
- You can define dependencies between pipelines using the
dependsorinput_mappingparameter to create a directed acyclic graph (DAG).
Complex Pipeline Example
Data Flow Management
The@transform decorator enables you to define data transformation functions efficiently.
Each function should:
- Accept input data as arguments
- Process the data
- Return the transformed data
Data is handled as PySpark DataFrames both for input and output operations.
clean_datafunction takesinput_dataas input. You can check the dataset alias in the Datazone UI or use thedatazone dataset listcommand to list all datasets.- After cleaning the data, the
clean_datafunction returns the cleaned data PySpark DataFrame as lazy evaluation. - The
aggregate_datafunction takes the cleaned data as input and aggregates it and returns the aggregated data. - Since the
materializedparameter is set toTrue, theaggregate_datafunction will be materialized and create a new dataset in Datazone.
Check the Transform section for more information on how to define a transform decorator.
Invoking LLM Models
Transforms can call an LLM through one of your Model Accounts with theAgent class — no provider SDK or API key in your pipeline code. The call is proxied by Datazone and its token usage is attributed to the pipeline.
class
Create an agent bound to a model account and model.Parameters:
model(optional) — model to use, e.g.CLAUDE_45_SONNET. Defaults to your organisation’s default model.model_account(optional) — model account id. Defaults to your organisation’s AI settings account.response_format(optional) — a Pydantic model or JSON schema dict for structured output.
method
Invoke the model and return a result dictionary.Accepts either a plain string or a message list:Message roles are
system, user and assistant. Returns a dict with:content— the raw text answer (empty whenresponse_formatis used)structured_response— the parsed object whenresponse_formatis used, otherwiseNonemodel— the model that produced the answer
RuntimeError if the invocation fails.Structured Output
Pass a Pydantic model asresponse_format to get a validated object back instead of raw text:
Transform Selection
When executing a pipeline, you can selectively run specific transforms using thetransform_selection parameter in the “Run with Config” modal. This allows you to execute only the transforms you need, along with their dependencies if required.
Selection Patterns
Use transform selection to optimize execution time by running only the necessary parts of your pipeline during development and testing.
Usage Examples
For the pipeline example above withprepare, build_project, build_report, and notify_email:
build_project- Runs only thebuild_projecttransform*build_project- Runsprepareandbuild_project(transform with all ancestors)prepare*- Runsprepare,build_project, andbuild_report(transform with all descendants)*notify_email*- Runs the entire pipeline (transform with all ancestors and descendants)