What is a Node?
A node is esssentially a single SQLSELECT statement.
Nodes live within pipes and are executed sequentially in the order they are defined in the pipe.
Each node can read data from sources, published pipes, or preceding nodes in the same pipe. It cannot read data from draft pipes or nodes defined later in the pipe.
The schema of the last node in the pipe determines the pipe’s schema.
Creation
Draft pipes
These are the starting point for all pipes, similar to database views in functionality. They cannot be referenced by other pipes using theFROM clause.
Draft pipes are temporary and primarily used for development. Once finalized, a draft pipe can be transitioned into either a published or a materialized pipe, but not both.
draft_pipe.yaml
A brief description of the pipe’s purpose or functionality. Optional.
The sequence of nodes within the pipe. Each node represents a stage in data processing.
Specifies the target source for appending the incremental results. When set, it converts the pipe into a materialized pipe. This option cannot be used with
publish and requires the final node’s schema to match the provided source schema. Optional.The endpoint name where the results are published, turning the pipe into a published pipe. This option cannot be used with
to. Optional.A list of parameters for parameterizing node SQL queries through Jinja2 templating e.g.
{{ param }}. These parameters are passed via the API and can be used to dynamically alter the pipe’s behavior. Optional.Published pipes
This creates an API endpoint that serves the result of your pipe, the result is accessible in JSON, NDJSON, CSV, and Parquet formats. To publish a draft pipe, assign an endpoint name to thepublish field.
Published pipes can parameterize their SQL using Jinja2 via the params field.
Unlike draft pipes, published pipes can be accessed (via FROM) by other pipes.
published_pipe.yaml
Materialized pipes
Differing from the batch nature of draft and published pipes, materialized pipes stand out for their ability to incrementally transform data as it is ingested and append their results to a designated source. To materialize a draft pipe, set theto field to the name of the target source.
Although materialized pipes themselves cannot be accessed (via FROM) by other pipes, the source they write to is accessible like any other source.
materialized_pipe.yaml
Note the materialized pipe example uses
countState() instead of count().Airfold uses ClickHouse under the hood which requires appending State to aggregate functions when used in a materialized pipe.Fortunately, Airfold does it automatically when materializing a draft pipe using af materialize <pipe_name>.Learn more about Materialization in ClickHouse, about the *State combinator.Push
Push pipes to your workspace using the CLI commandaf push or /push API.For example, to push
draft_pipe.yaml:

