{"id":8948,"date":"2016-11-28T16:04:12","date_gmt":"2016-11-28T07:04:12","guid":{"rendered":"http:\/\/www.skyarch.net\/blog\/?p=8948"},"modified":"2016-11-30T02:17:30","modified_gmt":"2016-11-29T17:17:30","slug":"boto3%e3%81%a7dynamodb%e3%81%ae%e6%93%8d%e4%bd%9c2","status":"publish","type":"post","link":"https:\/\/www.skyarch.net\/blog\/boto3%e3%81%a7dynamodb%e3%81%ae%e6%93%8d%e4%bd%9c2\/","title":{"rendered":"Boto3\u3067DynamoDB\u306e\u64cd\u4f5c2"},"content":{"rendered":"<h1>\u6982\u8981<\/h1>\n<p>DynamoDB\u306e\u64cd\u4f5c\u3092Boto3\u3067\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u7c21\u5358\u306a\u30c7\u30fc\u30bf\u306e\u633f\u5165\u3068\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\u3067\u3059\u3002<\/p>\n<h1>\u30c7\u30fc\u30bf\u306eInsert<\/h1>\n<pre>\n# -*- coding: utf-8 -*-\n\nimport boto3\nfrom boto3.session import Session\n\ndynamodb = boto3.resource('dynamodb', region_name='ap-northeast-1')\ntable = dynamodb.Table('customer')\n\nid = '1'\nname = 'handa'\n\nresponse = table.put_item(\n  Item = {\n    'id' : id,\n    'name' : name\n  }\n)\n<\/pre>\n<p>https:\/\/github.com\/handa3\/study\/blob\/master\/aws\/dynamodb\/insert_data.py<\/p>\n<h1>\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f<\/h1>\n<pre>\n # -*- coding: utf-8 -*-\n\nimport boto3\nfrom boto3.session import Session\n\ndynamodb = boto3.resource('dynamodb', region_name='ap-northeast-1')\ntable = dynamodb.Table('customer')\n\nclass read_class:\n  def data(self,i):\n    id = i\n    name = 'test'\n\n    response = table.get_item(\n      Key = {\n        'id' : id,\n        'name' : name\n      }\n    )\n\n    item = response['Item']\n    print item\n\nread = read_class()\n\nfor i in range(1, 10):\n  read.data(str(i))\n<\/pre>\n<p>https:\/\/github.com\/handa3\/study\/blob\/master\/aws\/dynamodb\/read_data.py<\/p>\n<h1>\u3055\u3044\u3054\u306b<\/h1>\n<p>\u5bfe\u8c61\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u672c\u4eba\u306e\u8a31\u53ef\u3092\u5f97\u3066\u3001\u63b2\u8f09\u3057\u3066\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 DynamoDB\u306e\u64cd\u4f5c\u3092Boto3\u3067\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002 \u7c21\u5358\u306a\u30c7\u30fc\u30bf\u306e\u633f\u5165\u3068\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\u3067\u3059\u3002 \u30c7\u30fc\u30bf\u306eInsert # -*- coding: utf-8 -*- import boto3 from boto3&#8230;<\/p>\n","protected":false},"author":1,"featured_media":8964,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"8948","footnotes":""},"categories":[20,19,9],"tags":[183,65],"class_list":{"0":"post-8948","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-aws","8":"category-19","9":"category-dev","10":"tag-boto","11":"tag-python","12":"ja"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/8948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/comments?post=8948"}],"version-history":[{"count":3,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/8948\/revisions"}],"predecessor-version":[{"id":8965,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/8948\/revisions\/8965"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media\/8964"}],"wp:attachment":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media?parent=8948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/categories?post=8948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/tags?post=8948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}