Community연구 & 데이터 분석github.com

Unknown-333/building-dagster-assets

Dagster 파이프라인을 소프트웨어 정의 자산(Software-defined Assets)을 사용하여 구축합니다. 자산 의존성, 파티션, 리소스 및 IO 매니저, 자산 검사, 스케줄/센서를 포함합니다. Dagster 자산이나 작업을 생성하거나, 데이터를 자산으로 모델링하거나, 파티션이나 백필을 추가하거나, 리소스/IO 매니저를 연결하거나, 태스크 기반 오케스트레이션에서 자산 기반으로 마이그레이션할 때 사용하세요.

building-dagster-assets란 무엇인가요?

이 스킬은 Dagster에서 소프트웨어 정의 자산(Software-defined Assets)을 사용하여 데이터 파이프라인을 구축하는 방법을 안내합니다. Dagster를 사용할 때 자산 중심의 사고 방식(asset thinking)으로 전환하여 각 출력물(테이블, 파일, ML 모델 등)을 `@asset`으로 모델링하고, 함수 파라미터로 업스트림 자산을 참조하여 의존성 그래프를 자동으로 구성합니다. 또한 파티션(시간/카테고리별 분할), 리소스 및 IO 매니저(연결 및 읽기/쓰기 로직 분리), 자산 검사(데이터 품질 검증), 스케줄/센서(자동 실행)와 같은 고급 패턴을 제공합니다. 이 스킬은 Claude Code, Cursor, Codex와 같은 AI 에이전트 플랫폼에서 사용할 수 있으며, SKILL.md 문서를 기반으로 사용자가 Dagster 프로젝트를 효율적으로 개발하도록 돕습니다. 특히 태스크 기반 오케스트레이션(예: Airflow)에서 자산 기반으로 마이그레이션할 때 유용하며, 자산 검사를 건너뛰거나 IO를 자산 본문에 하드코딩하는 일반적인 실수를 피하는 방법도 설명합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Unknown-333/awesome-data-engineering-skills/tree/main/skills/building-dagster-assets

Installed? Explore more 연구 & 데이터 분석 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Dagster 자산 구축하기

사용 시점

  • Dagster 소프트웨어 정의 자산 및 작업을 생성하거나 리팩토링할 때
  • 테이블/파일/ML 모델을 계보(lineage)를 포함한 자산으로 모델링할 때
  • 파티션, 백필, 자산 검사, 스케줄 또는 센서를 추가할 때
  • Airflow에는 사용하지 마십시오 (Airflow 스킬을 사용하세요).

워크플로우

- [ ] 각 출력을 @asset으로 모델링하고, 함수 인자를 통해 의존성 선언
- [ ] 시간/카테고리별 데이터에 파티션 추가
- [ ] IO(읽기/쓰기)를 IO 매니저 또는 리소스로 이동
- [ ] 데이터 품질을 위한 자산 검사 추가
- [ ] 스케줄/센서를 통해 구체화(materialize)
  1. 자산 중심으로 생각하고, 태스크 중심이 아닙니다. 자산은 영구적인 객체(테이블, 파일, 모델)입니다. 함수 파라미터로 업스트림 자산을 참조하여 의존성을 선언하면 Dagster가 자동으로 계보 그래프를 구축합니다.
  2. 파티션은 자연스럽게 분할되는(일별, 지역별) 자산에 적용하여 한 번에 하나의 조각만 구체화하거나 백필할 수 있게 합니다.
  3. 리소스 및 IO 매니저는 연결과 읽기/쓰기 로직을 보관하여 자산 본문을 변환에 집중시키고 테스트 가능하게 만듭니다.
  4. 자산 검사는 자산에 데이터 품질 검증을 연결합니다.

패턴

파티셔닝된 자산과 의존성:

import dagster as dg

daily = dg.DailyPartitionsDefinition(start_date="2026-01-01")

@dg.asset(partitions_def=daily)
def raw_orders(context: dg.AssetExecutionContext) -> None:
    day = context.partition_key
    write_parquet(f"raw/orders/{day}.parquet", fetch_orders(day))

@dg.asset(partitions_def=daily)
def orders_clean(context, raw_orders) -> None:  # raw_orders에 의존
    day = context.partition_key
    transform_and_load(day)

@dg.asset_check(asset=orders_clean)
def no_null_ids(context) -> dg.AssetCheckResult:
    n = count_null_order_ids(context.partition_key)
    return dg.AssetCheckResult(passed=n == 0, metadata={"null_ids": n})

리소스 / IO 매니저 — 자산 내부에서 직접 생성하는 대신 웨어하우스 클라이언트를 주입합니다:

@dg.asset
def orders_summary(context, warehouse: WarehouseResource, orders_clean):
    warehouse.execute("insert into summary select ...")

스케줄은 파티셔닝된 작업에 설정하여 각 실행이 최신 파티션을 구체화하도록 합니다. 센서는 업스트림 파일이나 자산이 나타날 때 구체화하도록 사용합니다.

일반적인 실수

  • 태스크 중심 사고 — 모든 것을 @op/작업으로 사용하면 자산이 무료로 제공하는 계보, 관찰 가능성, 파티션 인식 백필을 잃게 됩니다.
  • 자산 본문 내 IO — 연결을 하드코딩하면 자산을 테스트할 수 없게 됩니다. 리소스/IO 매니저를 사용하세요.
  • 비멱등성 파티셔닝 자산 — 파티션을 구체화할 때는 추가(append)가 아니라 덮어쓰기(overwrite)해야 합니다 (writing-idempotent-transformations 참조).
  • 자산 검사 건너뛰기 — 검사가 없으면 잘못된 데이터가 조용히 구체화됩니다. Dagster는 UI에서 검사 실패를 표시하고 다운스트림을 차단할 수 있습니다.
  • 의존 자산 간 파티션 정의 불일치 — partitions_def를 일관되게 유지하여 매핑이 올바르게 작동하도록 하세요.

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

Unknown-333/authoring-airflow-dags

Write production-grade Apache Airflow DAGs using the TaskFlow API — idempotent tasks, correct scheduling and catchup, retries/SLAs, connections/variables, and avoiding top-level code. Use when creating or reviewing Airflow DAGs, scheduling pipelines, wiring task dependencies, configuring retries/backfills, or fixing non-idempotent tasks.

Unknown-333/building-dbt-models

Build well-structured dbt models — staging/intermediate/marts layers, ref() and source(), materializations, and incremental models with the right strategy. Use when creating or refactoring dbt models, choosing table vs view vs incremental, structuring a dbt project, or writing incremental logic.

Unknown-333/building-feature-pipelines

Build ML feature pipelines and feature stores — point-in-time-correct joins to avoid label leakage, offline/online parity, feature freshness and backfills, and materialization with tools like Feast. Use when engineering features for ML, preventing train/serve skew or data leakage, building a feature store, or backfilling historical features for training.

Unknown-333/building-iceberg-tables

Design and operate Apache Iceberg tables — partitioning and hidden partitioning, partition/schema evolution, snapshots and time travel, compaction and small-file cleanup, and MERGE/upsert for lakehouse tables on Spark, Flink, Trino, or Snowflake. Use when creating or maintaining Iceberg tables, choosing partitioning, evolving schema/partitions, or fixing small-file and metadata bloat.

Unknown-333/building-ingestion-pipelines

Build batch and incremental data ingestion (extract-load) pipelines — full vs incremental extraction, change data capture (CDC), watermarks and high-water marks, API pagination and rate limits, and choosing managed EL tools (Fivetran, Airbyte) vs custom code. Use when ingesting data from databases, APIs, files, or SaaS into a warehouse/lake, or designing incremental extraction and CDC.

Unknown-333/building-kafka-consumers

Build reliable Apache Kafka consumers and producers — consumer groups and partition assignment, offset commit strategy, at-least-once vs exactly-once, idempotent/transactional producers, rebalancing, and dead-letter handling. Use when writing Kafka consumers/producers, configuring offset commits or consumer groups, tuning throughput, or handling rebalances and poison messages.

Unknown-333/debugging-data-pipelines

Systematically root-cause data pipeline failures and data incidents — job errors, wrong or missing data, duplicates, and freshness misses — by tracing lineage upstream, isolating the failing stage, reconciling against source, and planning a safe fix and backfill. Use when a pipeline fails, numbers look wrong, data is missing or duplicated, a dashboard is stale, or a stakeholder reports a data discrepancy.

Unknown-333/designing-backfills-and-replays

Plan and run safe data backfills and replays — idempotent reprocessing of historical windows, partition-by-partition execution, isolating backfill compute from production, verifying results, and avoiding double-counting or changed history. Use when backfilling a new or fixed model, reprocessing after a bug, replaying events, or loading history for a new pipeline without corrupting existing data.

Unknown-333/designing-data-contracts

Define and enforce data contracts between producers and consumers — explicit schema, semantics, ownership, SLAs, and versioning — to prevent silent upstream changes from breaking downstream pipelines. Use when a producer schema change could break consumers, defining an interface between teams/services and the warehouse, or adding schema enforcement at ingestion.

관련 스킬