Coder Social home page Coder Social logo

dbt-risingwave's Introduction

dbt-risingwave

A RisingWave adapter plugin for dbt.

RisingWave is a cloud-native streaming database that uses SQL as the interface language. It is designed to reduce the complexity and cost of building real-time applications. https://www.risingwave.com

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications. Use dbt for data transformations in RisingWave

Getting started

The package has not been published to PyPI, please install it via git.

  1. Install dbt-risingwave
python3 -m pip install dbt-risingwave
  1. Get RisingWave running

Please follow this guide to setup a functional RisingWave instance.

  1. Configure dbt profile file

The profile file is located in ~/.dbt/profiles.yml. Here's an example of how to use it with RisingWave.

default:
  outputs:
    dev:
      type: risingwave
      host: 127.0.0.1
      user: root
      pass: ""
      dbname: dev
      port: 4566
      schema: public
  target: dev
  1. Run dbt debug to check whether configuration is correct.

Models

The dbt models for managing data transformations in RisingWave is similar to typical dbt sql models. The main differences are the materializations. We customized the materializations to fit the data processing model of RisingWave.

Materializations INFO
materialized_view Create a materialized view. This materialization is corresponding to the incremental one in dbt. To use this materialization, add {{ config(materialized='materialized_view') }} to your model SQL files.
materializedview (Deprecated) only for backward compatibility, use materialized_view instead
ephemeral This materialization uses common table expressions in RisingWave under the hood. To use this materialization, add {{ config(materialized='ephemeral') }} to your model SQL files.
table Create a table. To use this materialization, add {{ config(materialized='table') }} to your model SQL files.
view Create a view. To use this materialization, add {{ config(materialized='view') }} to your model SQL files.
incremental Use materialized_view instead if possible, since RisingWave is designed to use materialized view to manage data transformation in an incremental way. From v1.7.3, dbt-risingwave support incremental model to give users better control of when to update their model. This model will update table in a batch way incrementally.
source Define a source {{ config(materialized='source') }}. You need to provide your create source statement as a whole in this model.
table_with_connector Define a table with a connector {{ config(materialized='table_with_connector') }}. You need to provide your create table with connector statement as a whole in this model. Because dbt table has its own semantics, RisingWave use table_with_connector to distinguish itself from it.
sink Define a sink {{ config(materialized='sink') }}. You need to provide your create sink statement as a whole in this model.

To learn how to use, you can check RisingWave offical example dbt_rw_nexmark.

DBT RUN behavior

  • dbt run: only create new models (if not exists) without dropping any models.
  • dbt run --full-refresh: drop models and create the new ones. This command can make sure your streaming pipelines are consistent with what you define in dbt models.

Graph operators

Graph operators is useful when you want to only recreate a subset of your models.

dbt run --select "my_model+"         # select my_model and all children
dbt run --select "+my_model"         # select my_model and all parents
dbt run --select "+my_model+"         # select my_model, and all of its parents and children

Tests

All items below have been tested against the the latest RisingWave daily build verison.

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.