dbt Cloud™️ infrastructure-as-code that is friendly to analysts

Overview

dbterra

dbt Cloud ™️ infrastructure-as-code that is friendly to analysts, bizops, etc

GitHub release (latest by date) GitHub license GitHub last commit

Motivation

While there are Terraform ™️ plugins that can be used to work with dbt Cloud ™️ jobs, environments, etc, we wanted a simple way to be able to create/modify/delete jobs within the same repository in a readable way that doesn't require any DevOps knowledge.

Usage

Usage: dbterra [OPTIONS] [COMMAND]

Commands:
  plan   Plans the changes derived from your dbt_cloud.yml file
  apply  Plans and applies the changes derived from your dbt_cloud.yml file
  help   Print this message or the help of the given subcommand(s)

Options:
  -d, --debug...  Turn debugging information on
  -h, --help      Print help
  -V, --version   Print version

In order to run, dbterra expects to environment variables to be set:

DBT_CLOUD_ACCOUNT_ID=123
DBT_CLOUD_TOKEN=abc123456xyz

DBT_CLOUD_ACCOUNT_ID

Your DBT_CLOUD_ACCOUNT_ID can be found by looking at the URL you use to access dbt Cloud

https://cloud.getdbt.com/deploy/<account_id>/projects/<project_id>/jobs

You may also declare this via account in your dbt_cloud.yml file.

DBT_CLOUD_TOKEN

Your DBT_CLOUD_TOKEN can be found at the bottom of your profile page

dbt_cloud.yml

The basic setup required that the dbt_cloud.yml file is present. dbterra looks for this file in the root folder of the current working directory. A sample file below demonstrates what this might look like:

# optionally allowed or can be set via DBT_CLOUD_ACCOUNT_ID 
# account:
#  id: 123

projects:
  example_project:
    # project_id in dbt cloud https://cloud.getdbt.com/deploy/<account_id>/projects/<project_id>/jobs
    id: 123
    jobs:
      seed:
        # the `name` attribute is automatically set from the "Title Case" of the YAML key
        # name: Seed
        environment: bizops
        target: production
        threads: 4
        steps:
          - dbt seed
      full_run:
        # if you want the name to be different than the YAML key, you may set it manually
        name: Full Production Run
        environment: bizops
        target: production
        steps:
          - dbt run
        generate_docs: true
        threads: 32
        schedule:
          cron: "0 9 * * *"
      
environments:
  bizops:
    # environment_id in dbt cloud https://cloud.getdbt.com/deploy/<project_id>/projects/<project_id>/environments/<environment_id>
    id: 456

Because we want to keep things simple and avoid storing state anywhere, the name is used as the unique identifier for a job within each project. This means if you rename something, it will first be deleted and then re-created.

The name key is optional and will default to the "Title Case" of the key of the job in the YAML file if not specified.

Installation

For convenience, we've built binaries for both x86_64 and aarch64 linux for both musl and gnu variants under the Releases section. If you want to install this on another system (such as Mac OS) and have cargo installed, you can use:

 cargo install dbterra --git https://github.com/Instawork/dbterra.git

What's missing?

  • Create/modify/delete environments (currently read-only)
  • Create/modify/delete projects (currently read-only)
  • Set id on an existing job instead of using name as unique identifier

Contributing

Please feel free to open a PR

Running tests

dbterra is relatively new and there aren't many tests, however there are enough to cover the basics.

To run the full test suite, use:

cargo test --all
You might also like...
Migrate C code to Rust
Migrate C code to Rust

C2Rust helps you migrate C99-compliant code to Rust. The translator (or transpiler) produces unsafe Rust code that closely mirrors the input C code. T

Mix async code with CPU-heavy thread pools using Tokio + Rayon

tokio-rayon Mix async code with CPU-heavy thread pools using Tokio + Rayon Resources Documentation crates.io TL;DR Sometimes, you're doing async stuff

Minimal, flexible framework for implementing solutions to Advent of Code in Rust

This is advent_of_code_traits, a minimal, flexible framework for implementing solutions to Advent of Code in Rust.

Waits until the exit code of a program is zero

Waitz A rust utility to wait that a program exits with 0. You need to wait for something to start up and don't know when it finishes?

Sample code for compute shader 101 training

Sample code for Compute Shader 101 This repo contains sample code to help you get started writing applications using compute shaders.

Detect if code is running inside a virtual machine (x86 and x86-64 only).

inside-vm Detect if code is running inside a virtual machine. Only works on x86 and x86-64. How does it work Measure average cpu cycles when calling c

Doku is a framework for building documentation with code-as-data methodology in mind.
Doku is a framework for building documentation with code-as-data methodology in mind.

Doku is a framework for building documentation with code-as-data methodology in mind. Say goodbye to stale, hand-written documentation - with D

A tool to run web applications on AWS Lambda without changing code.
A tool to run web applications on AWS Lambda without changing code.

AWS Lambda Adapter A tool to run web applications on AWS Lambda without changing code. How does it work? AWS Lambda Adapter supports AWS Lambda functi

Simplified glue code generation for Deno FFI libraries written in Rust.

deno_bindgen This tool aims to simplify glue code generation for Deno FFI libraries written in Rust. Quickstart # install CLI deno install -Afq -n den

Owner
Instawork
Find work at local businesses in less than 24 hours
Instawork
Rust Shop is a fake cloud-based software company that you can fork.

RustShop RustShop is an attempt at building a template and utilities to help quickly set up and manage a production grade cloud-based system. The core

null 56 Dec 17, 2022
Rust library to generate word cloud images from text and images !

wordcloud-rs A Rust library to generate word-clouds from text and images! Example Code use std::collections::HashMap; use std::fs; use lazy_static::la

Teo Orthlieb 2 Dec 8, 2022
UnlimCloud provides unlimited cloud storage for your files, utilizing Telegram as the storage solution

UnlimCloud provides unlimited cloud storage for your files, utilizing Telegram as the storage solution. Simply log in using your Telegram ID, and you are good to go.

inulute 5 Nov 27, 2023
Watches changes in a rust project, runs test and shows friendly notification

Cargo testify Automatically runs tests on your Rust project and notifies about the result. Install Install prerequisites (for Debian/Ubuntu): apt-get

Sergey Potapov 77 May 16, 2022
A strict, yet friendly mocking library for Rust 2018

Mockiato A strict, yet friendly mocking library for Rust 2018 ⚠️ Disclaimer for working with stable rust Mockiato relies on the unstable proc_macro_di

Mockiato 228 Dec 30, 2022
🐦 Friendly little instrumentation profiler for Rust 🦀

?? puffin The friendly little instrumentation profiler for Rust How to use fn my_function() { puffin::profile_function!(); ... if ... {

Embark 848 Dec 29, 2022
Rust Util Collection, a simple and friendly error-chain

RUC Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition. The painful experience of using error-chain gave b

漢 8 Dec 8, 2022
Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition.

RUC Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition. The painful experience of using error-chain gave b

漢 6 Mar 27, 2022
Minimal, flexible & user-friendly X and Wayland tiling window manager with rust

SSWM Minimal, flexible & user-friendly X and Wayland tiling window manager but with rust. Feel free to open issues and make pull requests. [Overview]

Linus Walker 19 Aug 28, 2023
Byte is a blazingly fast🚀 Discord Bot with a user-friendly design using twilight written in rust🦀.

Byte Byte is a blazingly fast?? Discord Bot with a user-friendly design using twilight written in rust??. How To Run There is a public version of the

TakoTheDev 3 Nov 15, 2023