Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit a417702

Browse files
authored
dbt-uuid (#455)
1 parent c180cb1 commit a417702

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

data_diff/dbt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def import_dbt():
2929

3030
from .tracking import (
3131
set_entrypoint_name,
32+
set_dbt_user_id,
3233
create_end_event_json,
3334
create_start_event_json,
3435
send_event_json,
@@ -84,6 +85,7 @@ def dbt_diff(
8485
custom_schemas = datadiff_variables.get("custom_schemas")
8586
# custom schemas is default dbt behavior, so default to True if the var doesn't exist
8687
custom_schemas = True if custom_schemas is None else custom_schemas
88+
set_dbt_user_id(dbt_parser.dbt_user_id)
8789

8890
if not is_cloud:
8991
dbt_parser.set_connection()
@@ -299,6 +301,7 @@ def __init__(self, profiles_dir_override: str, project_dir_override: str, is_clo
299301
self.connection = None
300302
self.project_dict = self.get_project_dict()
301303
self.manifest_obj = self.get_manifest_obj()
304+
self.dbt_user_id = self.manifest_obj.metadata.user_id
302305
self.requires_upper = False
303306
self.threads = None
304307
self.unique_columns = self.get_unique_columns()

data_diff/tracking.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ def set_entrypoint_name(s):
5656
global entrypoint_name
5757
entrypoint_name = s
5858

59+
dbt_user_id = None
60+
61+
def set_dbt_user_id(s):
62+
global dbt_user_id
63+
dbt_user_id = s
5964

6065
def get_anonymous_id():
6166
global g_anonymous_id
@@ -78,6 +83,7 @@ def create_start_event_json(diff_options: Dict[str, Any]):
7883
"diff_options": diff_options,
7984
"data_diff_version:": __version__,
8085
"entrypoint_name": entrypoint_name,
86+
"dbt_user_id": dbt_user_id,
8187
},
8288
}
8389

@@ -112,6 +118,7 @@ def create_end_event_json(
112118
"entrypoint_name": entrypoint_name,
113119
"is_cloud": is_cloud,
114120
"diff_id": diff_id,
121+
"dbt_user_id": dbt_user_id,
115122
},
116123
}
117124

0 commit comments

Comments
 (0)