Install
rivers alongside SQLBuild.
Try it
rivers_pipeline/definitions.py that includes asset definitions and a configured job. Open the Rivers UI to inspect assets and trigger materializations.
How it works
sqb compile --daggenerates a staticsqlbuild_dag.jsonartifact with your project’s full graph (nodes, edges)@sqlbuild_assets()reads the artifact and creates one RiversAssetDefper source, loader, seed, model, function, task, and asset, with dependency edges preserved- The decorated function runs
sqb buildas a subprocess and yieldsMaterializationevents for each output
Quickstart
SqlBuildProject
SqlBuildProject manages paths and DAG artifact generation:
| Field | Default | Description |
|---|---|---|
project_dir | required | Path to the SQLBuild project root |
target_path | target | Directory for build artifacts |
dag_filename | sqlbuild_dag.json | DAG artifact filename |
sqb_command | ("sqb",) | Command to invoke SQLBuild |
prepare_project_cli_args | ("compile", "--dag") | CLI arguments for DAG generation |
Methods
| Method | Description |
|---|---|
prepare() | Generate the DAG artifact by running sqb compile --dag |
prepare_if_dev() | Generate the DAG artifact only when RIVERS_DEPLOYMENT=dev |
dag_path | Property returning the full path to the DAG artifact |
prepare_if_dev() so the DAG artifact is auto-generated during local development but not during production deployments where it should already exist.
sqlbuild_assets
The@sqlbuild_assets() decorator creates a Rivers multi-asset definition from a SQLBuild DAG artifact:
| Parameter | Description |
|---|---|
project | SqlBuildProject instance (generates and locates the DAG artifact) |
dag | Alternative: pass a DAG path or dict directly instead of a project |
translator | Optional SqlBuildRiversTranslator for custom name/tag/metadata mapping |
name | Optional asset name override |
project or dag, not both.
SqlBuildRiversTranslator
Override the default mapping from SQLBuild DAG nodes to Rivers asset metadata:Translator methods
| Method | Default behavior |
|---|---|
get_asset_name(node) | Joins the asset key parts with __ (e.g. task__prepare_orders, asset__orders_export) |
get_group_name(node) | Uses the project name |
get_tags(node) | Includes sqlbuild/kind:<kind> plus model tags |
get_kinds(node) | Returns ["sqlbuild", "<materialization_type>"] |
get_metadata(node) | Includes SQLBuild name, kind, path, target, columns, etc. |

