Skip to content

wait_until_table_not_exists

wait_until_table_not_exists(
    table_name: TableArn,
    *,
    max_wait_time: float,
    min_delay: float = 20,
    max_delay: float = 120,
    config_overrides: Optional[DynamoDBClientConfig] = None,
) -> ServiceError

Wait for table_not_exists.

Parameters:

  • table_name (TableArn) –

    The name of the table to describe. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.

  • max_wait_time (float) –

    Maximum total seconds to wait before raising WaiterTimeoutError.

  • min_delay (float, default: 20 ) –

    Minimum seconds between operation attempts (spec default 2).

  • max_delay (float, default: 120 ) –

    Maximum seconds between operation attempts (spec default 120).

Source code in docs_src/capo_dynamodb/_services/dynamo_db.py
def wait_until_table_not_exists(
    self,
    table_name: "capo_dynamodb.types.table_arn.TableArn",
    *,
    max_wait_time: float,
    min_delay: float = 20,
    max_delay: float = 120,
    config_overrides: Optional[DynamoDBClientConfig] = None,
) -> ServiceError:
    """Wait for table_not_exists.

    Args:
        table_name: <p>The name of the table to describe. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
        max_wait_time: Maximum total seconds to wait before raising WaiterTimeoutError.
        min_delay: Minimum seconds between operation attempts (spec default 2).
        max_delay: Maximum seconds between operation attempts (spec default 120).
    """
    start = time.monotonic()
    attempt = 0
    while True:
        op_output: "capo_dynamodb.types.describe_table_output.DescribeTableOutput | None" = None
        op_error: ServiceError | None = None
        try:
            op_output = self.describe_table(  # noqa: F841
                table_name, config_overrides=config_overrides
            )
        except ServiceError as e:
            op_error = e
        if op_error is not None and op_error.code == "ResourceNotFoundException":
            return op_error
        elif op_error is not None:
            raise op_error

        elapsed = time.monotonic() - start
        remaining = max_wait_time - elapsed
        if remaining <= 0:
            raise WaiterTimeoutError("table_not_exists", max_wait_time)
        delay = min(max_delay, min_delay * (2**attempt))
        delay = random.uniform(min_delay, delay)
        delay = min(delay, remaining)
        time.sleep(delay)
        attempt += 1