remove prefix for partition key
This commit is contained in:
@@ -17,6 +17,7 @@ from layercake.dynamodb import (
|
||||
KeyPair,
|
||||
MissingError,
|
||||
PartitionKey,
|
||||
PrefixKey,
|
||||
)
|
||||
from pydantic import UUID4, BaseModel, StringConstraints
|
||||
|
||||
@@ -89,7 +90,7 @@ def get_emails(id: str):
|
||||
start_key = router.current_event.get_query_string_value('start_key', None)
|
||||
|
||||
return collect.get_items(
|
||||
key=KeyPair(id, 'emails'),
|
||||
KeyPair(id, PrefixKey('emails#')),
|
||||
start_key=start_key,
|
||||
)
|
||||
|
||||
@@ -104,7 +105,9 @@ def get_logs(id: str):
|
||||
start_key = router.current_event.get_query_string_value('start_key', None)
|
||||
|
||||
return collect.get_items(
|
||||
key=PartitionKey(ComposeKey(id, prefix='log', delimiter=':')),
|
||||
# Post-migration: uncomment to enable PartitionKey with a composite key (id with `logs` prefix).
|
||||
# PartitionKey(ComposeKey(id, prefix='logs')),
|
||||
PartitionKey(ComposeKey(id, prefix='log', delimiter=':')),
|
||||
start_key=start_key,
|
||||
)
|
||||
|
||||
@@ -119,6 +122,6 @@ def get_orgs(id: str):
|
||||
start_key = router.current_event.get_query_string_value('start_key', None)
|
||||
|
||||
return collect.get_items(
|
||||
key=KeyPair(id, 'orgs'),
|
||||
KeyPair(id, PrefixKey('orgs#')),
|
||||
start_key=start_key,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user