|
| 1 | +--- |
| 2 | +title: dbt Extension |
| 3 | +--- |
| 4 | + |
| 5 | +Segment's dbt extension lets you use [Reverse ETL](/docs/connections/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. |
| 6 | + |
| 7 | +With Segment's dbt extension, you can: |
| 8 | + |
| 9 | +- Securely connect Segment to the GitHub repository that stores your dbt models. |
| 10 | +- Use centralized dbt models to set up Reverse ETL. |
| 11 | +- Trigger Reverse ETL syncs from dbt jobs. |
| 12 | + |
| 13 | +This page explains how to set up a dbt Model and then use the model with Reverse ETL. |
| 14 | + |
| 15 | +> info "" |
| 16 | +> Extensions, including dbt sync, is currently in public beta and is governed by Segment's [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}. |
| 17 | +
|
| 18 | +## Before you begin |
| 19 | + |
| 20 | +Keep the following in mind as you set up the dbt extension: |
| 21 | + |
| 22 | +- The extension supports [dbt Core v1.7](https://docs.getdbt.com/docs/dbt-versions/core-upgrade/upgrading-to-v1.7){:target="_blank"}. |
| 23 | +- You can use [Snowflake](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/snowflake-setup/), [Databricks](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/databricks-setup/), [Redshift](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/redshift-setup/), [Postgres](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/postgres-setup/), and [BigQuery](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/bigquery-setup/) as Reverse ETL sources. |
| 24 | +- 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. |
| 25 | + |
| 26 | +## Set up Git dbt Models and dbt Cloud |
| 27 | + |
| 28 | +To set up the dbt extension, you'll need: |
| 29 | + |
| 30 | +- an existing dbt account with a Git repository |
| 31 | +- (for job syncs:) dbt cloud with jobs already created |
| 32 | + |
| 33 | +### Git repository and dbt Models setup |
| 34 | + |
| 35 | +Follow these steps to connect the Git repository that stores your dbt Models: |
| 36 | + |
| 37 | +1. In your Segment workspace, navigate to **Settings > Extensions**. |
| 38 | +2. Click **Set up Git sync**. |
| 39 | +3. On the **Configure service credentials** page, select a service and protocol, add your SSH private key or GitHub token, then click **Next**. |
| 40 | +4. In the **Connect source** window, select a Reverse ETL warehouse source from the dropdown, then click **Save**. |
| 41 | + |
| 42 | +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. |
| 43 | + |
| 44 | +### dbt Cloud setup |
| 45 | + |
| 46 | +You can also use dbt Cloud to schedule Reverse ETL syncs after a dbt Cloud job successfully runs. |
| 47 | + |
| 48 | +To set up dbt Cloud: |
| 49 | + |
| 50 | +1. In your Segment workspace, navigate to **Settings > Extensions**. |
| 51 | +2. Click **Manage dbt Cloud**. |
| 52 | +3. Add your dbt Cloud API key, and, optionally, a custom subdomain. Click **Save**. |
| 53 | + |
| 54 | +### Model syncs |
| 55 | + |
| 56 | +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. |
| 57 | + |
| 58 | +### Use a model with Reverse ETL |
| 59 | + |
| 60 | +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: |
| 61 | + |
| 62 | +1. In your Segment workspace, navigate to **Connections > Sources** and select the Reverse ETL tab. |
| 63 | +2. Click **+Add Reverse ETL source** , select your source, then click **Add Model**. |
| 64 | +3. Click **dbt Models** as your modeling method, then select and preview a model from the dbt model dropdown. |
| 65 | +4. Add a primary key, then click **Preview your model**. |
| 66 | +5. Click **Next**. |
| 67 | +6. Enter your **Model Name**, then click **Create Model**. |
| 68 | + |
| 69 | +To change a connected model, ensure that you've removed it from all active Reverse ETL syncs. |
0 commit comments