Slide 9
Slide 9 text
9
よくある解決策
class TableA:
def __init__(self, client):
self._client = client
def put_item(self, item):
self._client.put_item(TableName='tableA', Item=item)
class TableB:
def __init__(self, client):
self._client = client
def put_item(self, item):
self._client.put_item(TableName='tableB', Item=item)
import boto3
client = boto3.client('dynamodb’)
def handler(event, context):
table_a = TableA(client)
table_a.put_item({'foo': 'bar'})
table_b = TableB(client)
table_b.put_item({'hoge': 'fuga'})