JairoV
JairoV

Reputation: 2094

How can I wait for a dynamodb update table or ACTIVE state using boto3

I am changing the table, for example the capacity settings using boto3 then I need to wait for its completation

I would prefer a solution using boto3.resource('dynamodb').Table('MyTable') instead of dynamodb client.

Upvotes: 3

Views: 2690

Answers (1)

vijayraj34
vijayraj34

Reputation: 2415

Try this to make your program wait until the Table Update is finished:

def table_status_checker(self):
    while True:
        table = self.__dynamodb.Table('table_name')
        response = table.meta.client.describe_table(
            TableName='table_name'
        )
        print(response['Table']['TableStatus'])
        if response['Table']['TableStatus'] == 'ACTIVE':
            break

There is small lag between Console UI and this describe_table(...).
Therefore, don't get confused with the Console UI Table Status.

Upvotes: 2

Related Questions