代码之家  ›  专栏  ›  技术社区  ›  Harry

所有数据未存储在DynamoDB中

  •  0
  • Harry  · 技术社区  · 6 年前

    这是我的密码:

        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})
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Harry    6 年前

    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