Giter Site home page Giter Site logo

dbt-action's Introduction

Materialize dbt action

A GitHub action that runs dbt commands against a Materialize instance.

Required secrets

The following secrets are required:

Name Description Example
MZ_PASS The password for the Materialize user. MZ_PASS: ${{ secrets.MZ_PASS }}
MZ_USER The username for the Materialize user. MZ_USER: ${{ secrets.MZ_USER }}
MZ_HOST The host for the Materialize instance. MZ_HOST: ${{ secrets.MZ_HOST }}

Variables

You can override the default values for the following variables:

Name Description Default
DBT_MZ_VERSION dbt-materialize adapter version to install latest
MZ_DATABASE The database for the Materialize instance materialize
MZ_SCHEMA The schema for the Materialize instance public
MZ_CLUSTER The cluster for the Materialize instance default
DBT_PROJECT_FOLDER The dbt project folder .

Usage

Create a new workflow file in your repository, for example .github/workflows/materialize-dbt-action.yml and add the following content:

name: Materialize dbt action
on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - name: Materialize dbt action
      uses: MaterializeInc/dbt-action@main
      with:
        dbt_command: "dbt --version --profiles-dir /"
      env:
        DBT_MZ_VERSION: 1.3.4
        MZ_PASS: ${{ secrets.MZ_PASS }}
        MZ_USER: ${{ secrets.MZ_USER }}
        MZ_HOST: ${{ secrets.MZ_HOST }}
        MZ_DATABASE: materialize
        MZ_SCHEMA: public
        MZ_CLUSTER: default
        DBT_PROJECT_FOLDER: ${{ env.DBT_PROJECT_FOLDER }}

The above will run the dbt --version command against your Materialize instance on every push to the main branch.

To run on a pull request, change the on section to:

on:
  pull_request:
    branches:
      - main

Inputs

dbt_command

Required The dbt command to run. Default "dbt debug". You can change this to run any dbt command.

Overriding the default profiles.yml

You can override the default profiles.yml by creating a new file in your repository called profiles.yml and add the following content:

default:
  outputs:
    default:
      type: materialize
      threads: 1
      user: "{{ env_var('MZ_USER')}}"
      pass: "{{ env_var('MZ_PASS')}}"
      host: "{{ env_var('MZ_HOST')}}"
      port: 6875
      database: materialize
      schema: public
      cluster: default
      sslmode: require

  target: default

Then change the dbt_command input to dbt --version --profiles-dir . if you have a profiles.yml file in your repository. The ${DBT_PROJECT_FOLDER} will be added to the --profiles-dir argument.

This will override the default profiles.yml file and use the one from your repository.

DBT_PROJECT_FOLDER

You can specify a custom dbt project folder by setting the DBT_PROJECT_FOLDER environment variable. This is useful if you have multiple dbt projects in the same repository.

dbt-materialize version

By default the action will install the latest version of the dbt-materialize adapter. You can specify a specific version by setting the DBT_MZ_VERSION environment variable. For example:

env:
  DBT_MZ_VERSION: 1.3.2

dbt-action's People

Contributors

bobbyiliev avatar dehume avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dbt-action's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.