Skip to content

wip #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
6 changes: 6 additions & 0 deletions data_diff/dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def import_dbt():
from .tracking import (
set_entrypoint_name,
set_dbt_user_id,
set_dbt_version,
set_dbt_project_id,
create_end_event_json,
create_start_event_json,
send_event_json,
Expand Down Expand Up @@ -86,6 +88,8 @@ def dbt_diff(
# 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)
set_dbt_version(dbt_parser.dbt_version)
set_dbt_project_id(dbt_parser.dbt_project_id)

if not is_cloud:
dbt_parser.set_connection()
Expand Down Expand Up @@ -302,6 +306,8 @@ def __init__(self, profiles_dir_override: str, project_dir_override: str, is_clo
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.dbt_version = self.manifest_obj.metadata.dbt_version
self.dbt_project_id = self.manifest_obj.metadata.project_id
self.requires_upper = False
self.threads = None
self.unique_columns = self.get_unique_columns()
Expand Down
12 changes: 12 additions & 0 deletions data_diff/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def set_dbt_user_id(s):
global dbt_user_id
dbt_user_id = s

def set_dbt_version(s):
global dbt_version
dbt_version = s

def set_dbt_project_id(s):
global dbt_project_id
dbt_project_id = s

def get_anonymous_id():
global g_anonymous_id
if g_anonymous_id is None:
Expand All @@ -84,6 +92,8 @@ def create_start_event_json(diff_options: Dict[str, Any]):
"data_diff_version:": __version__,
"entrypoint_name": entrypoint_name,
"dbt_user_id": dbt_user_id,
"dbt_version": dbt_version,
"dbt_project_id": dbt_project_id,
},
}

Expand Down Expand Up @@ -119,6 +129,8 @@ def create_end_event_json(
"is_cloud": is_cloud,
"diff_id": diff_id,
"dbt_user_id": dbt_user_id,
"dbt_version": dbt_version,
"dbt_project_id": dbt_project_id
},
}

Expand Down