Blueprints

Git workflow for dbt — pull latest dbt changes from GitHub and build dbt models from your dbt project directory

About this blueprint

DuckDB Git dbt

This flow does the following:

  1. Clones the latest dbt code from GitHub
  2. Pulls a public container image with the latest package dependencies
  3. Runs dbt CLI commands in a Docker container.

Note how the dbt CLI commands use the --project-dir dbt flag. This is important because the example GitHub project we use has the dbt project code located in a dedicated folder.

If your dbt project is located outside of the root directory in your Git repository structure, make sure to use the --project-dir dbt flag.

yaml
id: dwh_and_analytics
namespace: company.team
description: |
  ## Data Platform
  Clone a [Git repository](https://github.com/kestra-io/dbt-example) and build dbt models

tasks:
  - id: dbt
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: clone_repository
        type: io.kestra.plugin.git.Clone
        url: https://github.com/kestra-io/dbt-example
        branch: master
  
      - id: dbt_build
        type: io.kestra.plugin.dbt.cli.DbtCLI
        taskRunner:
          type: io.kestra.plugin.scripts.runner.docker.Docker
        containerImage: ghcr.io/kestra-io/dbt-duckdb:latest
        commands:
          - dbt deps --project-dir dbt
          - dbt build --project-dir dbt
        profiles: |
          my_dbt_project:
            outputs:
              dev:
                type: duckdb
                path: dbt.duckdb
                extensions: 
                  - parquet
                fixed_retries: 1
                threads: 16
                timeout_seconds: 300
            target: dev

Working Directory

Clone

Dbt CLI

Docker

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra