Skip to main content

SqlBuildProject

Project metadata and DAG artifact preparation.

Methods

SqlBuildCliResource

Dagster ConfigurableResource that shells out to the SQLBuild CLI.

cli()

Create a CLI invocation for the provided command arguments.
Returns a SqlBuildCliInvocation.

SqlBuildCliInvocation

A running or completed SQLBuild CLI subprocess.

Methods

Properties

stream() behavior

stream() is the primary way to emit Dagster events from a SQLBuild execution:
  1. Waits for the subprocess to complete while streaming output to stdout/stderr
  2. Reads the structured execution JSON (from --json-output tempfile)
  3. Maps each completed asset to a MaterializeResult with metadata (status, duration, row counts)
  4. Maps each check result to an AssetCheckResult with pass/fail, severity, and check metadata
  5. If the DAG artifact is available, results are matched to the correct Dagster asset keys
  6. Raises Failure if the process exited non-zero and raise_on_error is set

sqlbuild_assets

Decorator that creates a Dagster multi-asset definition from a SQLBuild DAG artifact.
If neither project nor dag is provided, the decorator looks for target/sqlbuild_dag.json in the current directory.

sqlbuild_scenario_checks

Decorator that creates a Dagster multi-asset-check definition for SQLBuild scenarios only. Useful when you want to run scenarios separately from the main build.
Parameters are the same as sqlbuild_assets except there is no include_scenario_checks flag.

SqlBuildDagsterTranslator

Customise how SQLBuild DAG nodes map to Dagster asset metadata. Subclass and override any method.

Methods

Node structure

Each node dict passed to translator methods contains:
Python node asset keys use a two-part key with the node kind as prefix:

Check structure

Each check dict passed to check translator methods contains:
Scenario checks include additional fields: