Skill: Add a New Dagster Asset
Steps
-
Choose the layer file:
asset_bronze.py,asset_silver.py, orasset_gold.py. -
Declare the asset:
python1@asset(group_name="<layer>", deps=["<upstream_asset>"]) 2def <asset_name>(context: AssetExecutionContext) -> None: 3 """One-line description.""" 4 settings = PipelineSettings() 5 # ... logic 6 context.add_output_metadata({"key": "value"}) -
File naming: follow
<type>_<function>.pyfor any new utility files. -
Resources (e.g.
DbtCliResource): declare in function signature, already registered indefinitions.py. -
Register:
load_assets_from_modulesindefinitions.pypicks up the asset automatically if it's in the right module. -
Validate:
bash1uv run dotenv -f .env run -- uv run dagster asset list 2uv run dotenv -f .env run -- uv run dagster asset materialize --select <asset_name>