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

Commit

Permalink
fix: remove _id, _tenantId from bulk export results (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
carvantes authored Jul 23, 2021
1 parent ac8ba55 commit 09b299e
Showing 1 changed file with 10 additions and 2 deletions.
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'])

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

0 comments on commit 09b299e

Please sign in to comment.