In [1]:
import boto3
resource = boto3.resource('dynamodb', endpoint_url='http://localhost:8000')
table_to_delete = 'Census'
try:
table = resource.Table(table_to_delete)
table.delete()
print('Table {} deleted'.format(table_to_delete))
except Exception as e:
if 'ResourceNotFoundException' in str(e):
print('Table {} does not exist'.format(table_to_delete))