Skip to main content

Install the plugin

To use dbt to manage data in RisingWave, you need to install the dbt-risingwave plugin. As a prerequisite, you need to have Python3 installed in your environment. Run the following command to install the plugin:
After the plugin is installed, run the following command to ensure risingwave shows up under plugins.
If you see something like below, the plugin is successfully installed:

Initiate a dbt project

Before you initial a dbt project, you need to ensure that RisingWave is installed and running. To learn about how to install and run RisingWave, see the topics under Get started. You can initiate a dbt project by running the following command.
It will ask you to enter a project name, choose the database you like to use (risingwave), and specify other database configurations such as hostname, port, user name, etc. The default database configurations are:
  • host: localhost
  • port: 4566
  • user: root
  • database: dev
If you use different RisingWave configurations, please ensure that the configurations here match those in RisingWave.

Define dbt models

The dbt models for managing data transformations in RisingWave are similar to typical dbt SQL models. The main differences are the materializations. We customized the materializations to fit the data processing model of RisingWave. RisingWave accepts these materializations. To learn about how to define SQL models in general, see SQL models. To learn about how dbt works with RisingWave in practice, check out our demo project, which uses dbt to manage Nexmark queries in RisingWave.

Run dbt models

This step assumes that you have defined your dbt models. Navigate to your project directory.
First, you can run dbt debug to check your connection to RisingWave.
If the connection is valid, you will see an “OK connection ok” message. In this case, you can run your models. Otherwise, please check ~/.dbt/profiles.yml to ensure your connection configurations are valid. Run the following command to run your models.

Example model files

Define a source in dbt
Define a table with connector settings in dbt
Define a sink in dbt
Define a materialized view in dbt
Define a table with indexes in dbt

Additional resources

For details about building and deploying dbt models in general, please refer to the dbt documentation.