I need to delete a dynamodb table, and wait until it is completely removed. How can I check this?
boto3 api expose a method get_waiter
to wait for certain events, but it is not well documented. Can I use it for this purpose? Which would be the event name, or maybe handle a ResourceNotFoundException
# Wait until the table exists. table.meta.client.get_waiter('table_exists').wait(TableName='TableName')
Advertisement
Answer
After delete_table
API, call table_not_exists
waiter. This waits until the specified table returns 404.
import boto3 client = boto3.client('dynamodb') client.delete_table(TableName='foo') waiter = client.get_waiter('table_not_exists') waiter.wait(TableName='foo') print ("table deleted")
For create_table
API, call table_exists
waiter. This waits until the specified table gets active.