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

Adding user id to tracking #455

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions data_diff/dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def import_dbt():

from .tracking import (
set_entrypoint_name,
set_dbt_user_id,
create_end_event_json,
create_start_event_json,
send_event_json,
Expand Down Expand Up @@ -84,6 +85,7 @@ def dbt_diff(
custom_schemas = datadiff_variables.get("custom_schemas")
# custom schemas is default dbt behavior, so default to True if the var doesn't exist
custom_schemas = True if custom_schemas is None else custom_schemas
set_dbt_user_id(dbt_parser.dbt_user_id)

if not is_cloud:
dbt_parser.set_connection()
Expand Down Expand Up @@ -299,6 +301,7 @@ def __init__(self, profiles_dir_override: str, project_dir_override: str, is_clo
self.connection = None
self.project_dict = self.get_project_dict()
self.manifest_obj = self.get_manifest_obj()
self.dbt_user_id = self.manifest_obj.metadata.user_id
self.requires_upper = False
self.threads = None
self.unique_columns = self.get_unique_columns()
Expand Down
7 changes: 7 additions & 0 deletions data_diff/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def set_entrypoint_name(s):
global entrypoint_name
entrypoint_name = s

dbt_user_id = None

def set_dbt_user_id(s):
global dbt_user_id
dbt_user_id = s

def get_anonymous_id():
global g_anonymous_id
Expand All @@ -78,6 +83,7 @@ def create_start_event_json(diff_options: Dict[str, Any]):
"diff_options": diff_options,
"data_diff_version:": __version__,
"entrypoint_name": entrypoint_name,
"dbt_user_id": dbt_user_id,
},
}

Expand Down Expand Up @@ -112,6 +118,7 @@ def create_end_event_json(
"entrypoint_name": entrypoint_name,
"is_cloud": is_cloud,
"diff_id": diff_id,
"dbt_user_id": dbt_user_id,
},
}

Expand Down