Skip to content

sync_table_migration async

sync_table_migration(
    role_arn: RoleArn,
    table_arn: TableARN,
    migration_output: MigrationOutputConfiguration,
    *,
    config_overrides: Optional[AsyncS3TablesClientConfig] = None,
    review_migration_plan: Optional[bool] = None,
) -> SyncTableMigrationResponse

Migrates the changes in the source table since the previous start or sync, such as added and deleted source objects, into the destination table. The sync runs asynchronously: this operation returns the migration ID of the sync and its initial state, and you track progress with GetTableMigration.

A sync uses the source, destination, and data migration settings of the table's migration, and plans the work and writes its reports in the same way as StartTableMigration. You can sync after a start or sync that succeeded, failed, or was cancelled, if an earlier start or sync of the table has a valid plan (hasValidPlan). You can't sync a table while a start or sync is in progress for it, and you can sync a table until you call CompleteTableMigration for it.

If you overwrite a source object after an earlier migration migrated it, the sync fails. If no earlier start or sync of the table has a valid plan, you can't sync the table. To migrate it again, delete the destination table and start a new migration.

Permissions
  • You must have the s3tables:SyncTableMigration permission to use this operation.

  • You must have the iam:PassRole permission on the role that you specify in roleARN, with a condition that allows passing it to migration.s3tables.amazonaws.com. Set the iam:AssociatedResourceArn condition key to the table ARN.

Parameters:

  • role_arn (RoleArn) –

    The Amazon Resource Name (ARN) of the IAM role that the sync uses to read the source table and its data and to write the destination table and the reports. The role must be in your account, and its trust policy must allow migration.s3tables.amazonaws.com to assume it. You can limit the trust policy to the destination table bucket with the aws:SourceArn and aws:SourceAccount condition keys.

  • table_arn (TableARN) –

    The Amazon Resource Name (ARN) of the destination table to sync. The table must have a migration, and you must not have called CompleteTableMigration for it.

  • review_migration_plan (Optional[bool], default: None ) –

    Specifies whether the sync waits in the pendingReview state, so that you can review the compatibility reports before it migrates any data. Valid values:

    • true - The sync waits in pendingReview until you call UpdateTableMigration with requestedState set to queued. If you don't continue or cancel the sync within 30 days, the sync fails with internalError.

    • false - The sync continues without waiting for review. This is the default.

  • migration_output (MigrationOutputConfiguration) –

    The bucket and prefixes that the sync writes its reports to. The bucket must be a general purpose bucket in your account and in the same Region as the table bucket, and the migration role must be able to write objects to it. Otherwise, the migration fails when it writes its first report.

Raises:

  • AccessDeniedException –

    The action cannot be performed because you do not have the required permission.

  • BadRequestException –

    The request is invalid or malformed.

  • ConflictException –

    The request conflicts with the resource's current state, such as a previous write, an existing table, or a migration that's in progress or already in the requested state. If the conflict is with a concurrent write, you can retry the request.

  • ForbiddenException –

    The caller isn't authorized to make the request.

  • InternalServerErrorException –

    The request failed due to an internal server error.

  • NotFoundException –

    The request was rejected because the specified resource could not be found.

  • TooManyRequestsException –

    The limit on the number of requests per second was exceeded.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_s3tables/_services/async_s3_tables.py
async def sync_table_migration(
    self,
    role_arn: "capo_s3tables.types.role_arn.RoleArn",
    table_arn: "capo_s3tables.types.table_arn.TableARN",
    migration_output: "capo_s3tables.types.migration_output_configuration.MigrationOutputConfiguration",
    *,
    config_overrides: Optional[AsyncS3TablesClientConfig] = None,
    review_migration_plan: Optional[bool] = None,
) -> "capo_s3tables.types.sync_table_migration_response.SyncTableMigrationResponse":
    """<p>Migrates the changes in the source table since the previous start or sync, such as added and deleted source objects, into the destination table. The sync runs asynchronously: this operation returns the migration ID of the sync and its initial state, and you track progress with <code>GetTableMigration</code>.</p> <p>A sync uses the source, destination, and data migration settings of the table's migration, and plans the work and writes its reports in the same way as <code>StartTableMigration</code>. You can sync after a start or sync that succeeded, failed, or was cancelled, if an earlier start or sync of the table has a valid plan (<code>hasValidPlan</code>). You can't sync a table while a start or sync is in progress for it, and you can sync a table until you call <code>CompleteTableMigration</code> for it.</p> <p>If you overwrite a source object after an earlier migration migrated it, the sync fails. If no earlier start or sync of the table has a valid plan, you can't sync the table. To migrate it again, delete the destination table and start a new migration.</p> <dl> <dt>Permissions</dt> <dd> <ul> <li> <p>You must have the <code>s3tables:SyncTableMigration</code> permission to use this operation.</p> </li> <li> <p>You must have the <code>iam:PassRole</code> permission on the role that you specify in <code>roleARN</code>, with a condition that allows passing it to <code>migration.s3tables.amazonaws.com</code>. Set the <code>iam:AssociatedResourceArn</code> condition key to the table ARN.</p> </li> </ul> </dd> </dl>

    Args:
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that the sync uses to read the source table and its data and to write the destination table and the reports. The role must be in your account, and its trust policy must allow <code>migration.s3tables.amazonaws.com</code> to assume it. You can limit the trust policy to the destination table bucket with the <code>aws:SourceArn</code> and <code>aws:SourceAccount</code> condition keys.</p>
        table_arn: <p>The Amazon Resource Name (ARN) of the destination table to sync. The table must have a migration, and you must not have called <code>CompleteTableMigration</code> for it.</p>
        review_migration_plan: <p>Specifies whether the sync waits in the <code>pendingReview</code> state, so that you can review the compatibility reports before it migrates any data. Valid values:</p> <ul> <li> <p> <code>true</code> - The sync waits in <code>pendingReview</code> until you call <code>UpdateTableMigration</code> with <code>requestedState</code> set to <code>queued</code>. If you don't continue or cancel the sync within 30 days, the sync fails with <code>internalError</code>.</p> </li> <li> <p> <code>false</code> - The sync continues without waiting for review. This is the default.</p> </li> </ul>
        migration_output: <p>The bucket and prefixes that the sync writes its reports to. The bucket must be a general purpose bucket in your account and in the same Region as the table bucket, and the migration role must be able to write objects to it. Otherwise, the migration fails when it writes its first report.</p>

    Raises:
        capo_s3tables.errors.access_denied_exception.AccessDeniedException: <p>The action cannot be performed because you do not have the required permission.</p>
        capo_s3tables.errors.bad_request_exception.BadRequestException: <p>The request is invalid or malformed.</p>
        capo_s3tables.errors.conflict_exception.ConflictException: <p>The request conflicts with the resource's current state, such as a previous write, an existing table, or a migration that's in progress or already in the requested state. If the conflict is with a concurrent write, you can retry the request.</p>
        capo_s3tables.errors.forbidden_exception.ForbiddenException: <p>The caller isn't authorized to make the request.</p>
        capo_s3tables.errors.internal_server_error_exception.InternalServerErrorException: <p>The request failed due to an internal server error.</p>
        capo_s3tables.errors.not_found_exception.NotFoundException: <p>The request was rejected because the specified resource could not be found.</p>
        capo_s3tables.errors.too_many_requests_exception.TooManyRequestsException: <p>The limit on the number of requests per second was exceeded.</p>
        capo_s3tables.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_s3tables.types.sync_table_migration_request.SyncTableMigrationRequest]",
    ) -> AsyncOperationResponse[
        "capo_s3tables.types.sync_table_migration_response.SyncTableMigrationResponse"
    ]:
        import capo_s3tables._operations.s3_table_buckets.sync_table_migration

        (
            output,
            http_response,
        ) = await capo_s3tables._operations.s3_table_buckets.sync_table_migration.async_sync_table_migration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SyncTableMigration")
    )
    input_: capo_s3tables.types.sync_table_migration_request.SyncTableMigrationRequest = {
        "role_arn": role_arn,
        "table_arn": table_arn,
        "migration_output": migration_output,
    }
    if review_migration_plan is not None:
        input_["review_migration_plan"] = review_migration_plan

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output