Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

fix: remove _id, _tenantId from bulk export results #384

Merged
merged 1 commit into from
Jul 23, 2021
Merged
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
12 changes: 10 additions & 2 deletions bulkExport/glueScripts/export-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,22 @@
)

print('Start filtering by tenantId')

def remove_composite_id(resource):
# Replace the multi-tenant composite id with the original resource id found at "_id"
resource["id"] = resource["_id"]
return resource

# Filter by tenantId
if (tenantId is None):
filtered_tenant_id_frame = original_data_source_dyn_frame
else:
filtered_tenant_id_frame = Filter.apply(frame = original_data_source_dyn_frame,
filtered_tenant_id_frame_with_composite_id = Filter.apply(frame = original_data_source_dyn_frame,
f = lambda x:
x['_tenantId'] == tenantId)

filtered_tenant_id_frame = Map.apply(frame = filtered_tenant_id_frame_with_composite_id, f = remove_composite_id)

print('Start filtering by transactionTime and Since')
# Filter by transactionTime and Since
datetime_since = datetime.strptime(since, "%Y-%m-%dT%H:%M:%S.%fZ")
Expand All @@ -96,7 +104,7 @@

# Drop fields that are not needed
print('Dropping fields that are not needed')
data_source_cleaned_dyn_frame = DropFields.apply(frame = filtered_dates_resource_dyn_frame, paths = ['documentStatus', 'lockEndTs', 'vid', '_references'])
data_source_cleaned_dyn_frame = DropFields.apply(frame = filtered_dates_resource_dyn_frame, paths = ['documentStatus', 'lockEndTs', 'vid', '_references', '_tenantId', '_id'])
Bingjiling marked this conversation as resolved.
Show resolved Hide resolved

def add_dup_resource_type(record):
record["resourceTypeDup"] = record["resourceType"]
Expand Down