Warehouse-native DBT Integration

This article helps you:

  • Efficiently manage multiple models with a DBT integration

The warehouse-native DBT integration helps you manage your warehouse native models.
Instead of managing one model at a time, create or edit multiple models with the DBT manifest file.

Approach

This section details how you can annotate the DBT manifest file's metadata to automatically generate all data models.

Supported operations

Warehouse-native Amplitude supports both create and update operations with the manifest file. For each table present in the manifest file, you can create multiple data models.

To create data models based on a table, add amplitude_meta as a key to the metadata for the table. The value associated with the amplitude_meta key must be a dictionary with a single key, data_models. The value associated with the data_models key must be a list of data model descriptions.

A data model description is a dictionary with three keys, name, type, and special_columns. The value associated with the name key must be a globally unique string among all data model descriptions, and is used to identify the specific data model. If this name isn't present in any existing data model, Amplitude creates a new data model with this name.

Otherwise, the data model with that name is overwritten with the specified configuration.

The value associated with the type key defines
the type of data model and must be one of the following:

  • EVENT
  • EVENT_PROPERTIES
  • CURRENT_USER_PROPERTIES
  • HISTORICAL_USER_PROPERTIES
  • CURRENT_GROUP_PROPERTIES
  • HISTORICAL_GROUP_PROPERTIES

The value associated with the special_columns key must be a dictionary with
specified keys as follows:

Data Model Type Keys Expected
EVENT unique_id, event_time
EVENT_PROPERTIES event_type
CURRENT_USER_PROPERTIES unique_id
HISTORICAL_USER_PROPERTIES unique_id, start_time, end_time
CURRENT_GROUP_PROPERTIES unique_id
HISTORICAL_GROUP_PROPERTIES unique_id, start_time, end_time

Each key in the dictionary associated with the special_columns should be associated
with a string corresponding to the key in the columns dictionary.

What happens to models that aren't configured in the manifest file?

Amplitude ignores and doesn't alter models that aren't in the manifest file.

What happens to tables which don't specify the amplitude_meta key?

Amplitude ignores all such tables.

Example

1{
2 "nodes": {
3 "event_table": {
4 "database": "database",
5 "schema": "schema",
6 "name": "table_name",
7 "meta": {
8 "amplitude_meta": {
9 "data_models": [
10 {
11 "name": "data_model_name",
12 "type": "EVENT",
13 "special_columns": {
14 "unique_id": "unique_id_col",
15 "event_time": "event_time_col"
16 }
17 }
18 ]
19 }
20 },
21 "columns": {
22 "event_time_col": {
23 "name": "event_time_col"
24 },
25 "unique_id_col": {
26 "name": "unique_id_col"
27 }
28 }
29 }
30 }
31}
Was this page helpful?

Thanks for your feedback!

December 21st, 2024

Need help? Contact Support

Visit Amplitude.com

Have a look at the Amplitude Blog

Learn more at Amplitude Academy

© 2024 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.