Most pipelines need the same ten steps. They are already written.
Standard pipes
Filter, rename, split, merge, group, convert: the standard library is the plumbing every pipeline needs, addressed as std:<name> and built into the runner. Nothing to install, nothing to lock.
Each pipe below has its own page with its ports, its parameters and an example taken from the pipe's own tests. The exact contract of every pipe is in the standard library specification.
28 pipes in standard library v0.1, read from the specification repository when this site was built. The same list for tools: /std/index.json.
Building an extract–transform–load job? The ETL guide shows how sources, transformations and sinks fit together.
Record transformations #
Change what a record looks like — one record in, one record out: compute, pick, rename and convert its members.
Emits the value of a Starlark expression for every item.
For example: compute a new value from every record.
in → out
Keeps only the listed members of each record.
For example: keep only the columns a report needs.
in → out
Renames members of each record.
For example: rename the columns of an export to the names your pipes expect.
in → out
Converts members of each record to a JSON type, exactly or not at all.
For example: turn the strings of a CSV file into numbers and booleans.
in → out, rejected
Filtering and counting #
Decide which records go on: by a condition, by position in the stream, or only the first of every key.
Keeps the items for which a Starlark expression is truthy.
For example: drop test accounts before a report.
in → out, rejected
Emits at most the first
countitems.For example: try a pipeline on the first 100 records.
in → out
Discards the first
countitems.For example: skip the first records — a preamble, or a page already read.
in → out
Keeps the first item for every distinct key; bounded by maxKeys.
For example: remove duplicate webhook deliveries.
in → out
Routing #
Send records down different branches, and bring branches back into one stream.
Routes each item to
matchedorunmatchedby a boolean expression.For example: send paid orders one way and unpaid ones another.
in → matched, unmatched
Routes items to one of up to eight outputs by key.
For example: spread records over up to eight branches by key.
in → p0, p1, p2, p3, p4, p5, p6, p7
Merges several streams into one, interleaved or concatenated.
For example: combine orders from two shops into one stream.
in → out
Batching #
Turn single records into arrays and arrays back into records — for steps that work on many records per call.
Groups consecutive items into JSON arrays of
sizeitems.For example: group 500 records into one array for a bulk API call.
in → out
Flattens array items into their elements.
For example: turn arrays back into single records.
in → out
Windows #
Cut a stream into groups with a meaning — the last five readings, every hundred orders — and pass each group on as one line.
Record-count tumbling, sliding and partitioned windows.
For example: average the last 5 readings, or total per customer.
in → out
Draft. Groups items by arrival time. Non-deterministic.
For example: draft: group whatever arrives within a time span.
in → out
Format conversion #
Move between text, records and Arrow, and check records against a schema. Conversions that can lose information are always explicit nodes.
Parses NDJSON text into items.
For example: read NDJSON text as records.
in → out
Serialises items as NDJSON text.
For example: hand records to a tool that reads text.
in → out
Parses CSV text into records of strings.
For example: read a spreadsheet export as records.
in → out
Serialises records as CSV text.
For example: give a result to someone who wants a CSV file.
in → out
Converts records to Arrow record batches, refusing lossy values.
For example: hand records to an Arrow-based tool without losing precision.
in → out
Converts Arrow record batches to records, refusing lossy values.
For example: read an Arrow stream as plain records.
in → out
Routes items by validity against a JSON Schema.
For example: stop malformed records before they reach a database.
in → valid, rejected
Sources and sinks #
Where data enters and leaves a pipeline: standard streams, files and HTTP. The ones that touch files or the network need a grant.
Source: the runner's standard input as NDJSON.
For example: read records piped into the runner.
no input → out
Sink: the runner's standard output as NDJSON.
For example: print results for the next shell command.
in → no output
Source: an NDJSON file. Needs a filesystem.read grant covering
path.For example: start a pipeline from an NDJSON file.
no input → out
Sink: an NDJSON file. Needs a filesystem.write grant covering
path.For example: write results to an NDJSON file.
in → no output
Source: NDJSON fetched with one HTTP GET. Needs a network grant for the URL's host:port.
For example: fetch an NDJSON export over HTTPS.
no input → out
Sink: consumes and discards its input.
For example: end a branch whose output you do not need.
in → no output