I'm trying to save some data from a JSON to DynamoDB but only 283 out of 592 items are getting stored.
here is my code:
r = requests.get(url)
j = r.json()
for features in j["accountsWithGeo"]["features"]:
i = features["properties"]["id"]
n = features["properties"]["name"]
table.put_item(Item={'id':i,'name':n})
I now works after doing it like this:
def dbWriter(data):
with table.batch_writer() as batch:
item_counter=0
while item_counter<len(data):
item=data[item_counter]
batch.put_item(
Item=item
)
item_counter +=1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.