Blueprints

Orchestrate SQLMesh and DuckDB engine

About this blueprint

DuckDB SQL

This blueprint shows how you can pull a SQLMesh project from a Git repository and run a query on top ot it with DuckDB.

yaml
id: sqlmesh
namespace: blueprint
description: Clone SQLMesh project and run the project, and query with DuckDB
tasks:

  - id: working_dir
    type: io.kestra.core.tasks.flows.WorkingDirectory
    tasks:
    
      - id: git_clone
        type: io.kestra.plugin.git.Clone
        url: https://github.com/TobikoData/sqlmesh-examples.git
        branch: main

      - id: sqlmesh
        type: io.kestra.plugin.sqlmesh.cli.SQLMeshCLI
        beforeCommands:
          - cd 001_sushi/1_simple
        commands:
          - sqlmesh plan --auto-apply
        outputFiles:
          - '001_sushi/1_simple/db/sushi-example.db'

  - id: query
    type: io.kestra.plugin.jdbc.duckdb.Query
    inputFiles:
      data.db: "{{ outputs.sqlmesh.outputFiles['001_sushi/1_simple/db/sushi-example.db'] }}"
    sql: |
      ATTACH '{{workingDir }}/data.db';
      SELECT * FROM sushisimple.top_waiters;
    store: true

Working Directory

Clone

SQLMesh CLI

Query

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra