Skip to content

Commit

Permalink
docs: Document DynamoDBOnlineStore public methods (#2348)
Browse files Browse the repository at this point in the history
* docs: document DynamoDBOnlineStore public methods

Signed-off-by: unknown <[email protected]>
Signed-off-by: Miguel Trejo <[email protected]>

* sign commit

Signed-off-by: unknown <[email protected]>
Signed-off-by: Miguel Trejo <[email protected]>
  • Loading branch information
TremaMiguel authored and adchia committed Mar 4, 2022
1 parent f959e1e commit 58e71e5
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions sdk/python/feast/infra/online_stores/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class DynamoDBOnlineStoreConfig(FeastConfigBaseModel):
class DynamoDBOnlineStore(OnlineStore):
"""
Online feature store for AWS DynamoDB.
Attributes:
_dynamodb_client: Boto3 DynamoDB client.
_dynamodb_resource: Boto3 DynamoDB resource.
"""

_dynamodb_client = None
Expand All @@ -71,6 +75,14 @@ def update(
entities_to_keep: Sequence[Entity],
partial: bool,
):
"""
Update tables from the DynamoDB Online Store.
Args:
config: The RepoConfig for the current FeatureStore.
tables_to_delete: Tables to delete from the DynamoDB Online Store.
tables_to_keep: Tables to keep in the DynamoDB Online Store.
"""
online_config = config.online_store
assert isinstance(online_config, DynamoDBOnlineStoreConfig)
dynamodb_client = self._get_dynamodb_client(online_config.region)
Expand Down Expand Up @@ -109,6 +121,13 @@ def teardown(
tables: Sequence[FeatureView],
entities: Sequence[Entity],
):
"""
Delete tables from the DynamoDB Online Store.
Args:
config: The RepoConfig for the current FeatureStore.
tables: Tables to delete from the feature repo.
"""
online_config = config.online_store
assert isinstance(online_config, DynamoDBOnlineStoreConfig)
dynamodb_resource = self._get_dynamodb_resource(online_config.region)
Expand All @@ -126,6 +145,21 @@ def online_write_batch(
],
progress: Optional[Callable[[int], Any]],
) -> None:
"""
Write a batch of feature rows to online DynamoDB store.
Note: This method applies a ``batch_writer`` to automatically handle any unprocessed items
and resend them as needed, this is useful if you're loading a lot of data at a time.
Args:
config: The RepoConfig for the current FeatureStore.
table: Feast FeatureView.
data: a list of quadruplets containing Feature data. Each quadruplet contains an Entity Key,
a dict containing feature values, an event timestamp for the row, and
the created timestamp for the row if it exists.
progress: Optional function to be called once every mini-batch of rows is written to
the online store. Can be used to display progress.
"""
online_config = config.online_store
assert isinstance(online_config, DynamoDBOnlineStoreConfig)
dynamodb_resource = self._get_dynamodb_resource(online_config.region)
Expand Down Expand Up @@ -155,6 +189,17 @@ def online_read(
entity_keys: List[EntityKeyProto],
requested_features: Optional[List[str]] = None,
) -> List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]]:
"""
Retrieve feature values from the online DynamoDB store.
Note: This method is currently not optimized to retrieve a lot of data at a time
as it does sequential gets from the DynamoDB table.
Args:
config: The RepoConfig for the current FeatureStore.
table: Feast FeatureView.
entity_keys: a list of entity keys that should be read from the FeatureStore.
"""
online_config = config.online_store
assert isinstance(online_config, DynamoDBOnlineStoreConfig)
dynamodb_resource = self._get_dynamodb_resource(online_config.region)
Expand Down

0 comments on commit 58e71e5

Please sign in to comment.