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

Commit

Permalink
Merge branch 'master' into 784
Browse files Browse the repository at this point in the history
  • Loading branch information
sar009 authored Jan 11, 2024
2 parents 9bd278f + 69a37b7 commit 44bddad
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data_diff/databases/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
FractionalType,
DbPath,
TimestampTZ,
Integer,
)
from data_diff.databases.postgresql import (
BaseDialect,
Expand All @@ -31,6 +32,8 @@ class Dialect(PostgresqlDialect):
"double": Float,
"real": Float,
"super": JSON,
"int": Integer, # Redshift Spectrum
"float": Float, # Redshift Spectrum
}
SUPPORTS_INDEXES = False

Expand Down
2 changes: 2 additions & 0 deletions data_diff/diff_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def diff_tables(self, table1: TableSegment, table2: TableSegment, info_tree: Inf
def _diff_tables_wrapper(self, table1: TableSegment, table2: TableSegment, info_tree: InfoTree) -> DiffResult:
if is_tracking_enabled():
options = attrs.asdict(self, recurse=False)
# not a useful event attribute
options.pop("_ignored_columns_lock")
options["differ_name"] = type(self).__name__
event_json = create_start_event_json(options)
run_as_daemon(send_event_json, event_json)
Expand Down
17 changes: 17 additions & 0 deletions data_diff/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,27 @@ def create_email_signup_event_json(email: str) -> Dict[str, Any]:
}


def convert_sets_to_lists(obj):
"""
Recursively convert sets in the given object to lists.
"""
if isinstance(obj, set):
return list(obj)
elif isinstance(obj, dict):
return {k: convert_sets_to_lists(v) for k, v in obj.items()}
elif isinstance(obj, list):
return [convert_sets_to_lists(elem) for elem in obj]
else:
return obj


def send_event_json(event_json) -> None:
if not g_tracking_enabled:
raise RuntimeError("Won't send; tracking is disabled!")

# Convert sets to lists in event_json
event_json = convert_sets_to_lists(event_json)

headers = {
"Content-Type": "application/json",
"Authorization": "Basic MkhndE00SGNxOUJtZWlDcU5ZaHo3Tzl0a2pNOg==",
Expand Down

0 comments on commit 44bddad

Please sign in to comment.