Skip to content

Commit

Permalink
Explicitly store original keys for S3Store metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhorton committed Jan 12, 2022
1 parent efd3494 commit 6fafeb5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/maggma/stores/aws.py
Expand Up @@ -386,10 +386,11 @@ def write_doc_to_s3(self, doc: Dict, search_keys: List[str]):
# calling the PutObject operation: There were headers present in the request
# which were not signed`
# Metadata stored in the MongoDB index (self.index) is stored unchanged.
search_doc["s3-to-mongo-keys"] = {k: k.replace('_', '-') for k in search_doc.keys()}
s3_bucket.put_object(
Key=self.sub_dir + str(doc[self.key]),
Body=data,
Metadata={k.replace('_', '--'): str(v) for k, v in search_doc.items()},
Metadata={search_doc["s3-to-mongo-keys"][k]: str(v) for k, v in search_doc.items()},
)

if lu_info is not None:
Expand Down

0 comments on commit 6fafeb5

Please sign in to comment.