dbt Extension

Segment’s dbt extension lets you use Reverse ETL with your existing dbt labs models and syncs to help centralize model management and versioning, reduce redundancies, and run CI checks to prevent breaking changes.

With Segment’s dbt extension, you can:

  • Securely connect Segment to the GitHub repository that stores your dbt models.
  • Use centralized dbt models to set up Reverse ETL.
  • Trigger Reverse ETL syncs from dbt jobs.

This page explains how to set up a dbt Model and then use the model with Reverse ETL.

Extensions, including dbt sync, is currently in public beta and is governed by Segment’s First Access and Beta Preview Terms.

Before you begin

Keep the following in mind as you set up the dbt extension:

  • The extension supports dbt Core v1.7.
  • You can use Snowflake, Databricks, Redshift, Postgres, and BigQuery as Reverse ETL sources.
  • dbt models aren’t synchronized from the dbt cloud. The model sync connects to a Git repository that loads models into Segment for use with Reverse ETL.

Set up Git dbt Models and dbt Cloud

To set up the dbt extension, you’ll need:

  • an existing dbt account with a Git repository
  • (for job syncs:) dbt cloud with jobs already created

Git repository and dbt Models setup

Follow these steps to connect the Git repository that stores your dbt Models:

  1. In your Segment workspace, navigate to Settings > Extensions.
  2. Click Set up Git sync.
  3. On the Configure service credentials page, select a service and protocol, add your SSH private key or GitHub token, then click Next.
  4. In the Connect source window, select a Reverse ETL warehouse source from the dropdown, then click Save.

After you’ve saved your setup, you can configure your Git repository’s settings to your needs by changing the repository, branch, dbt version, default schema, and project path.

dbt Cloud setup

You can also use dbt Cloud to schedule Reverse ETL syncs after a dbt Cloud job successfully runs.

To set up dbt Cloud:

  1. In your Segment workspace, navigate to Settings > Extensions.
  2. Click Manage dbt Cloud.
  3. Add your dbt Cloud API key, and, optionally, a custom subdomain. Click Save.

Model syncs

After you set up dbt, Segment runs an initial sync to load models from your connected Git repository. This initial sync lets you use the most recent models when you set up Reverse ETL. In addition to Segment’s initial dbt sync, you can also trigger manual dbt model syncs.

Use a model with Reverse ETL

After you’ve successfully set up dbt with a warehouse and connected to your Git repository, you can select dbt models for use with Reverse ETL by following these steps:

  1. In your Segment workspace, navigate to Connections > Sources and select the Reverse ETL tab.
  2. Click +Add Reverse ETL source , select your source, then click Add Model.
  3. Click dbt Models as your modeling method, then select and preview a model from the dbt model dropdown.
  4. Add a primary key, then click Preview your model.
  5. Click Next.
  6. Enter your Model Name, then click Create Model.

To change a connected model, ensure that you’ve removed it from all active Reverse ETL syncs.

This page was last modified: 21 May 2024



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account