-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_elements.py
40 lines (35 loc) · 999 Bytes
/
delete_elements.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from boto3.dynamodb.conditions import Key, Attr
from connect import forecast
''' delete 1 item '''
# with forecast.batch_writer() as batch:
# batch.delete_item(
# Key={
# 'weather': 'rain',
# 'number': '10'
# }
# )
''' delete all items with certain expression '''
# scan = forecast.scan(
# FilterExpression=Attr('weather').eq('sunny')
# )
#
# #
# with forecast.batch_writer() as batch:
# for each in scan['Items']:
# if int(each['temperature']) < 0:
# batch.delete_item(
# Key={
# 'weather': each['weather'],
# 'number': each['number']
# }
# )
''' delete all items '''
# scan = forecast.scan()
# with forecast.batch_writer() as batch:
# for each in scan['Items']:
# batch.delete_item(
# Key={
# 'weather': each['weather'],
# 'number': each['number']
# }
# )