Giter Club home page Giter Club logo

mage-dbt-quickstart's Introduction

About

This repo contains two dbt quickstart project using Mage.

The first, simple_dbt_python_pipeline, seeds a demo customers dataset from the dbt jaffle shop demo, executes a staging model, and performs a Python transformation on the dataset before exporting it to Postgres.

The second pulls the jaffle_shop demo from dbt and creates a profiles.yml file for executing it. Running the pipeline triggers a dbt build, writing data to the postgres database in our Docker Network. This is a sample workflow for pulling a dbt project from an external repo, a common pattern in dbt development.

Prerequisites

  1. Docker
  2. Git

The following command will clone the repo, copy dev.env to .env and run docker compose up to start Mage.

Mac/Linux

git clone https://github.com/mage-ai/dbt-quickstart mage-dbt-quickstart \
&& cd mage-dbt-quickstart \
&& cp dev.env .env && rm dev.env \
&& docker compose up

Windows

git clone https://github.com/mage-ai/dbt-quickstart mage-dbt-quickstart 
cd mage-dbt-quickstart
cp dev.env .env
rm dev.env
docker compose up

Run pipelines

After running the above command, you'll see the Mage overview page. Click the pipelines icon on the left to enter the pipelines overview.

A Simple dbt Python Pipeline

First, select the simple_dbt_python_pipeline by double-clicking— this will take you directly to the editor. You can also single click, then select the "code" icon from the side nav.

Select Run + Execute Pipeline to see the pipeline execute.

You just:

  • Seeded a dbt model
  • Performed a dbt transformation
  • Took the transformed data and performed a Python transformation
  • Wrote the data to a Postgres source

To see the output, you can use a querying tool (like DataGrip or psql) to the locally hosted Postgres database and query public.analytics.cur_customers.

A Dynamic dbt Python Pipeline

Next, return to the overview page. Select the dynamic_dbt_pipeline by double-clicking— this will take you directly to the editor. You can also single click, then select the "code" icon from the side nav.

Select Run + Execute Pipeline to see the pipeline execute.

You just:

  • Pulled a GitHub repo and wrote it to your local Mage directory
  • Wrote a demo profiles.yaml file that interpolated environment variables from your instance
  • Executed dbt build to write data to your local postgres database

To see the output, you can use a querying tool (like DataGrip or psql) to the locally hosted Postgres database and check out the public.analytics schema.

mage-dbt-quickstart's People

Contributors

mattppal avatar

Watchers

 avatar

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.