Docs

Templates and slots

What an Emolysis template contains, the eleven slot types, how slots are filled and validated, and how to write your own templates.

Planned reference

Updated Oct 23, 2026

Docs menu · 25 pagesTemplates and slots

Status

In private development. Early access by invitation. The names, options and formats on this page can change before the first release.

On this page

A template is the tested, platform-specific form of one pipeline shape. Emolysis fills templates instead of writing pipelines from scratch, so every pipeline starts from code that already passes its tests. The template format is public, so you can read it and write your own.

Template ids

A template is named <shape>.<platform>, for example scd2.databricks or cdc-merge.snowflake. Local-only examples use duckdb as the platform. Ten shapes on three platforms make thirty templates in the library.

The shape part is the id from the pipeline shapes: ingest-batch, incremental-append, cdc-merge, scd2, snapshot, backfill, late-arriving, dedupe-conform, aggregation-gold and reverse-etl. The platform part is databricks, snowflake, fabric or duckdb.

What is in a template

Each template is a folder:

Files
scd2.databricks/
  template.sql        the template file, with named slots (or template.py)
  manifest            declares the template id, its slots and their types
  tests/              input fixtures and the expected output for each case
  cost note           what drives the template's cost on its platform
  constraints         what the template needs from the platform profile
  • The template file, template.sql or template.py, with named slots where values go.
  • A manifest that declares the template's id, its slots and their types. Its format id is emolysis.template/v0.
  • Tests: input fixtures, usually Parquet, and the expected output for each case.
  • A cost note that says what drives the template's cost on its platform, such as a full table scan or a warehouse that stays awake.
  • Platform constraints: what the template needs from the platform profile, such as a table format or a minimum feature.

The file names in the tree above are for orientation. The format specification in the public SDK repository is the source of truth for exact names.

Slots and their types

A slot is a named value the template needs. Every slot has a type, so the agent cannot put a column list where a table name belongs:

TypeHolds
identifierA name, such as a constraint or job name
tableA table reference
columnOne column
columnsA list of columns, such as a composite key
expressionOne SQL expression
expressionsA list of SQL expressions
stringText
integerA whole number
booleanTrue or false
durationA length of time, such as a lookback window
enumOne value from a fixed list

What the slots look like per shape

The slots follow what each shape needs. These are the kinds of values the agent asks for, in plain words:

ShapeValues the template needs
Ingest (batch)Source location and format, target table, schema hints, the columns that identify a duplicate
Incremental appendSource, target, the watermark column and its type, an optional lookback window
CDC mergeKey columns, the ordering column, the operation column and its values, how deletes are handled
SCD Type 2Business key, tracked columns, where the effective date comes from, the current flag
SnapshotSource, target, snapshot date column, retention period, replace or keep dated copies
BackfillThe pipeline to run, partition column, grain, date range, how many partitions run at once
Aggregation / goldThe grain, the measures and their aggregates, the dimensions, the source tables

How slots get filled

The slot schema tells the agent exactly what is missing. It fills slots from your catalog where it can (column names and types, keys), from your request where you said it, and asks you for the rest. Literal values are rendered for the target platform's dialect, so quoting and escaping follow that platform's rules.

Because values have types, a value of the wrong type is rejected with an invalid_params error before anything is rendered, instead of producing a broken query. See Error codes.

Validation

The public validator checks a template folder against the format: the manifest, the slot types, the fixtures and the expected outputs. A template that does not validate is not rendered.

Writing your own

The format and the validator are public in emolysis/template-sdk on GitHub (MIT license). You can write templates for your own recurring patterns and use them in your projects. The tested library that ships with Emolysis stays part of the product. The SDK package is not published to a registry yet.

Readiness

Each library template is judged per platform:

  • Green: it passes its golden tests on the real platform.
  • Yellow: it passes on DuckDB only.
  • Missing: it does not exist yet.

The matrix of shapes by platforms is the scorecard for the library. A template does not count as green until it has run on the real platform. See Golden tests on DuckDB.

Status

The library holds a template for each shape on Databricks, Snowflake and Microsoft Fabric. Their golden tests pass on DuckDB, and none has passed on a real platform yet. The template format is public as source, not as a package, and can change before the first release.