replication to meili

This commit is contained in:
2025-08-24 21:23:45 -03:00
parent f004be8a4a
commit 1326530991
9 changed files with 152 additions and 26 deletions

View File

@@ -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