replication to meili
This commit is contained in:
@@ -21,7 +21,7 @@ def lambda_handler(event: DynamoDBStreamEvent, context: LambdaContext):
|
||||
with Op(meili_client) as op:
|
||||
for record in event.records:
|
||||
pk = record.dynamodb.keys['id'] # type: ignore
|
||||
new_image = sanitize(record.dynamodb.new_image) # type: ignore
|
||||
new_image = record.dynamodb.new_image # type: ignore
|
||||
index = table_from_arn(record.event_source_arn) # type: ignore
|
||||
|
||||
op.append(
|
||||
@@ -29,13 +29,3 @@ def lambda_handler(event: DynamoDBStreamEvent, context: LambdaContext):
|
||||
op=record.event_name, # type: ignore
|
||||
data=new_image or pk,
|
||||
)
|
||||
|
||||
|
||||
# Post-migration: remove the following function
|
||||
def sanitize(obj):
|
||||
if isinstance(obj, dict):
|
||||
return {k.replace(':', '__'): sanitize(v) for k, v in obj.items()}
|
||||
elif isinstance(obj, list):
|
||||
return [sanitize(item) for item in obj]
|
||||
else:
|
||||
return obj
|
||||
|
||||
Reference in New Issue
Block a user