Skip to content
Open
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
8 changes: 4 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,7 @@ def _transform_amplitude_profiles(self, amplitude_profile):
profile = {
"$token": self.token,
"$distinct_id": amplitude_profile["user_id"],
"$ip": amplitude_profile["ip_address"],
"$ip": amplitude_profile["ip_address"] if "ip_address" in amplitude_profile else "0.0.0.0",
"$properties": {**properties, **default_properties}
}

Expand All @@ -2285,8 +2285,8 @@ def _transform_amplitude_events(self, amplitude_event):
"amplitude_id"],
"$device_id": amplitude_event["device_id"],
"time": int(event_dt.timestamp() * 1000),
"ip": amplitude_event["ip_address"],
"mp_country_code": amplitude_event["country"]
"ip": amplitude_event["ip_address"] if "ip_address" in amplitude_event else "0.0.0.0",
"mp_country_code": amplitude_event["country"] if "country" in amplitude_event else "Unknown"
}

default_properties = {
Expand Down Expand Up @@ -2372,7 +2372,7 @@ def _transform_and_load_amplitude_data(self, extract_data_path):
event.get("user_id") and event.get("amplitude_id")]

unique_merge_events = self._dedupe_merge_events(merge_events)

print("Importing %s" % filename)
self.import_people(transformed_profiles)
self.import_events(transformed_events, 0)
self.import_events(unique_merge_events, 0)
Expand Down