Skip to content

Commit

Permalink
Only add tags to dynamodb when configured
Browse files Browse the repository at this point in the history
Signed-off-by: hkuepers <[email protected]>
  • Loading branch information
hkuepers committed Apr 16, 2024
1 parent abc8449 commit ce328f6
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions sdk/python/feast/infra/online_stores/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,18 @@ def update(
dynamodb_resource = self._get_dynamodb_resource(
online_config.region, online_config.endpoint_url
)

# Add Tags attribute to creation request only if configured to prevent
# TagResource permission issues, even with an empty Tags array.
kwargs = (
{
"Tags": [
{"Key": key, "Value": value}
for key, value in online_config.tags.items()
]
}
if online_config.tags
else {}
)
for table_instance in tables_to_keep:
try:
dynamodb_resource.create_table(
Expand All @@ -117,12 +128,7 @@ def update(
{"AttributeName": "entity_id", "AttributeType": "S"}
],
BillingMode="PAY_PER_REQUEST",
Tags=[
{"Key": key, "Value": value}
for key, value in online_config.tags.items()
]
if online_config.tags is not None
else [],
**kwargs,
)
except ClientError as ce:
# If the table creation fails with ResourceInUseException,
Expand Down

0 comments on commit ce328f6

Please sign in to comment.