Spaces:
Configuration error

chat / init.py
yonkasoft's picture
Upload 15 files
681c53e verified
raw
history blame
598 Bytes
import boto3
class DynamoDBService:
def __init__(self, table_name):
self.dynamodb = boto3.resource('dynamodb')
self.table = self.dynamodb.Table(table_name)
return table_name
def put_item(self, item):
response = self.table.put_item(Item=item)
return response
def get_item(self, key):
response = self.table.get_item(Key=key)
return response
# Singleton olarak bir tabloya bağlanmak için aşağıdaki gibi tanımlayabilirsiniz
dynamodb_service = DynamoDBService('new_table')