# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import boto3 # Note this must reflect the table defined in template.yml def createExceptionsTable(tableName, dynamodb=None): if not dynamodb: dynamodb = boto3.resource('dynamodb', endpoint_url='http://localhost:8000') table = dynamodb.create_table( TableName=tableName, KeySchema=[ { 'AttributeName': 'partKey', 'KeyType': 'HASH' }, { 'AttributeName': 'sortKey', 'KeyType': 'RANGE' } ], AttributeDefinitions=[ { 'AttributeName': 'partKey', 'AttributeType': 'S' }, { 'AttributeName': 'sortKey', 'AttributeType': 'S' } ], ProvisionedThroughput={ 'ReadCapacityUnits': 1, 'WriteCapacityUnits': 1 } ) # Wait until the table exists. table.meta.client.get_waiter('table_exists').wait(TableName=tableName) assert table.table_status == 'ACTIVE' return table