digdag

Orchestrate Treasure Data Digdag workflows with td> operators and session variables.

21|24|Updated Oct 21, 2025
One-click install
npx skills add https://github.com/treasure-data/td-skills --skill digdag
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: digdag
Source: https://github.com/treasure-data/td-skills/tree/main/workflow-skills/digdag
Command: npx skills add https://github.com/treasure-data/td-skills --skill digdag

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides expert assistance for designing, implementing, and debugging digdag workflows for Treasure Data, simplifying the orchestration of complex data pipelines. It helps users define schedules, manage dependencies, handle errors, and leverage TD-specific operators for efficient and reliable data processing.

Core Features & Use Cases

  • Workflow Definition: Guides on structuring .dig files, defining tasks, and configuring schedules (daily, hourly, cron), automating routine data jobs.
  • TD Operator Usage: Explains how to use the td> operator for running SQL queries, including inline SQL and external files, with dynamic session variables.
  • Error Handling & Retries: Provides patterns for implementing robust error handling with _error: blocks and retry logic with _retry: for resilient workflows that recover from transient issues.
  • Use Case: A data analyst needs to automate a daily report that extracts data from multiple TD tables, transforms it, and loads it into a dashboard. This skill helps them define a digdag workflow with scheduled execution, error alerts, and efficient data processing using the td> operator.

Quick Start

Create a simple daily workflow file (e.g., my_workflow.dig)

timezone: Asia/Tokyo schedule: daily>: 03:00:00 +start: echo>: "Daily job for ${session_date} started!"

Run locally in TD environment

td wf run my_workflow.dig

Frequently Asked Questions about digdag

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate data pipeline execution with scheduled workflows?

Digdag orchestrates scheduled data pipelines by defining tasks in `.dig` files with cron or daily schedules, executing them automatically at specified times. Use the `schedule:` directive to set frequency (daily, hourly, cron syntax) and structure tasks with `+task` prefixes to run sequentially or in parallel, enabling hands-off automation of ETL jobs.

How do I run SQL queries on Treasure Data within a workflow?

The `td>` operator executes SQL queries directly within digdag workflows. Specify your query inline or reference an external SQL file, configure the database and output table with `create_table:` and `engine:` parameters, and leverage session variables like `${session_date}` to parameterize queries for dynamic data processing.

What's the best way to handle errors and retries in data pipelines?

Digdag provides `_error:` blocks to define error-handling logic and `_retry:` parameters to automatically retry failed tasks with exponential backoff. Combine these patterns to build resilient workflows that recover from transient failures and trigger alerts or recovery actions when errors occur.

Can I run complex data transformations across multiple Treasure Data tables in a single workflow?

Yes. Design workflows with multiple `td>` tasks that extract, transform, and load data across tables using inline SQL or external scripts. Use parallel execution, conditional branching, and session variables to coordinate multi-stage pipelines, and deploy via `tdx` CLI for monitoring and scheduling.

Do I need programming experience to define digdag workflows for Treasure Data?

No. Digdag uses declarative YAML syntax in `.dig` files, not code. Define tasks, schedules, and operators using straightforward configuration; SQL knowledge helps for `td>` queries, but the workflow structure itself requires only familiarity with YAML formatting and basic scheduling concepts.

What session variables are available for dynamic query parameterization?

Digdag provides `${session_date}`, `${session_time}`, and `${session_date_compact}` as built-in session variables that inject execution timestamps into queries. These enable time-based partitioning, incremental loads, and date-stamped outputs without manual parameter updates across workflow runs.