-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# import boto3 | ||
|
||
# dynamodb = boto3.resource('dynamodb') | ||
# table = dynamodb.Table('services') | ||
|
||
# response = table.scan() | ||
# items = response['Items'] | ||
|
||
# for item in items: | ||
# # Check if the 'Name' attribute exists | ||
# if 'Name' in item: | ||
# normalized_name = item['Name'].lower() | ||
|
||
# # Update item with normalized fields | ||
# table.update_item( | ||
# Key={'Id': item['Id']}, # Use your table's primary key | ||
# UpdateExpression="SET NormalizedName = :n", | ||
# ExpressionAttributeValues={ | ||
# ':n': normalized_name | ||
# } | ||
# ) | ||
# else: | ||
# print(f"Item {item} does not contain a 'Name' attribute.") | ||
import boto3 | ||
|
||
dynamodb = boto3.resource("dynamodb") | ||
table = dynamodb.Table("services") | ||
|
||
response = table.scan() | ||
items = response["Items"] | ||
|
||
for item in items: | ||
# Check if the 'Name' attribute exists | ||
if "Name" not in item: | ||
# Print the item being deleted | ||
print(f"Deleting item: {item}") | ||
|
||
# Delete the item from the table | ||
table.delete_item(Key={"Id": item["Id"]}) # Use your table's primary key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters