Recipes

Data movement

Schedule a dbt build with artifacts

Run a pinned dbt adapter on a schedule and keep dbt target and log files as Dagu run artifacts.

Supported platforms

LinuxmacOSWindows

Prerequisites

  • A dbt project and profiles directory available to the Dagu worker
  • Warehouse credentials supplied through the dbt profile environment

Workflow YAML

description: Run dbt build on a schedule and preserve dbt artifacts.
schedule: "0 4 * * *"

params:
  - name: project_dir
    default: /srv/dbt/project
  - name: profiles_dir
    default: /srv/dbt/profiles
  - name: target
    default: prod
  - name: threads
    type: integer
    default: 4
    minimum: 1
    maximum: 32

steps:
  - id: dbt_build
    action: dbt@v1
    with:
      projectDir: ${params.project_dir}
      profilesDir: ${params.profiles_dir}
      requirements:
        - dbt-postgres==1.9.0
      command: build
      target: ${params.target}
      threads: ${params.threads}
      failFast: true
      targetPath: ${context.paths.artifacts_dir}/dbt-target
      logPath: ${context.paths.artifacts_dir}/dbt-logs
      timeoutSeconds: 3600

Review before running

Replace example values, configure the listed secrets, and review every command for your environment. Syntax validation does not make a community workflow trusted.

Running this workflow with a team?

The Team plan adds SSO, role-based access, audit logs, incident routing, and priority support for three self-hosted Dagu servers. Start a 14-day trial without a credit card.

Start Team trial
View sourceInstall DaguContributed by @dagucloud · validated with Dagu 2.13.0

Related Recipes