Skip to content

start_metadata_model_conversion async

start_metadata_model_conversion(
    migration_project_identifier: MigrationProjectIdentifier,
    selection_rules: String,
    *,
    config_overrides: Optional[AsyncDatabaseMigrationServiceClientConfig] = None,
) -> StartMetadataModelConversionResponse

Queues a conversion of the selected source metadata models (database objects such as tables, views, and procedures) to the target database format. If other requests created by Start* operations are already in the migration project's queue, the conversion begins after they complete.

The conversion request loads metadata models that are not yet in the metadata tree, but does not reload metadata models that are already present. If your source database has changed since the metadata was loaded, refresh the affected metadata models with StartMetadataModelImport before calling this operation.

If converted objects already exist in the target metadata tree, the conversion overwrites them, including any manual edits.

To check the status of the conversion request, call DescribeMetadataModelConversions using the returned RequestIdentifier as a filter.

To cancel a queued or in-progress request, call CancelMetadataModelConversion with the returned RequestIdentifier.

After the conversion completes successfully:

Required permissions: dms:StartMetadataModelConversion. For more information, see Actions, resources, and condition keys for Database Migration Service.

Parameters:

  • migration_project_identifier (MigrationProjectIdentifier) –

    The migration project name or Amazon Resource Name (ARN).

  • selection_rules (String) –

    A JSON string that identifies the metadata models to convert. For the selection rule format and examples, see Selection rules in DMS Schema Conversion.

    Usage:

    • Accepts only source selection rules, where server-name in the object locator matches the source data provider.

    • Supports explicit, include, and exclude rule actions.

Raises:

Examples:

Convert all objects in a schema The following example queues a conversion of all objects in the ExampleSchema schema to the target database format.

>>> await client.start_metadata_model_conversion(migration_project_identifier='arn:aws:dms:us-east-1:111122223333:migration-project:EXAMPLEABCDEFGHIJKLMNOPQRS', selection_rules='{"rules": [{"rule-type": "selection","rule-id": "1","rule-name": "1","object-locator": {"server-name": "example-source-server.us-east-1.rds.amazonaws.com", "schema-name": "ExampleSchema"},"rule-action": "explicit"}]}')
Source code in docs_src/capo_database_migration_service/_services/async_database_migration_service.py
async def start_metadata_model_conversion(
    self,
    migration_project_identifier: "capo_database_migration_service.types.migration_project_identifier.MigrationProjectIdentifier",
    selection_rules: "capo_database_migration_service.types.string.String",
    *,
    config_overrides: Optional[AsyncDatabaseMigrationServiceClientConfig] = None,
) -> "capo_database_migration_service.types.start_metadata_model_conversion_response.StartMetadataModelConversionResponse":
    """<p>Queues a conversion of the selected source metadata models (database objects such as tables, views, and procedures) to the target database format. If other requests created by <code>Start*</code> operations are already in the migration project's queue, the conversion begins after they complete.</p> <p>The conversion request loads metadata models that are not yet in the metadata tree, but does not reload metadata models that are already present. If your source database has changed since the metadata was loaded, refresh the affected metadata models with <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_StartMetadataModelImport.html">StartMetadataModelImport</a> before calling this operation.</p> <note> <p>If converted objects already exist in the target metadata tree, the conversion overwrites them, including any manual edits.</p> </note> <p>To check the status of the conversion request, call <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_DescribeMetadataModelConversions.html">DescribeMetadataModelConversions</a> using the returned <code>RequestIdentifier</code> as a filter.</p> <p>To cancel a queued or in-progress request, call <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_CancelMetadataModelConversion.html">CancelMetadataModelConversion</a> with the returned <code>RequestIdentifier</code>.</p> <p>After the conversion completes successfully:</p> <ul> <li> <p>To export a post-conversion assessment report, call <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_ExportMetadataModelAssessment.html">ExportMetadataModelAssessment</a>.</p> </li> <li> <p>To retrieve converted code, use any of the following options:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_DescribeMetadataModel.html">DescribeMetadataModel</a> and <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_DescribeMetadataModelChildren.html">DescribeMetadataModelChildren</a> – navigate the target metadata tree and retrieve converted definitions.</p> </li> <li> <p> <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_StartMetadataModelExportAsScript.html">StartMetadataModelExportAsScript</a> – export as data definition language (DDL) scripts to your Amazon S3 bucket.</p> </li> <li> <p> <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_StartMetadataModelExportToTarget.html">StartMetadataModelExportToTarget</a> – apply directly to your target database.</p> </li> </ul> </li> </ul> <p> <b>Required permissions:</b> <code>dms:StartMetadataModelConversion</code>. For more information, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsdatabasemigrationservice.html">Actions, resources, and condition keys for Database Migration Service</a>.</p>

    Args:
        migration_project_identifier: <p>The migration project name or Amazon Resource Name (ARN).</p>
        selection_rules: <p>A JSON string that identifies the metadata models to convert. For the selection rule format and examples, see <a href="https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html">Selection rules in DMS Schema Conversion</a>.</p> <p>Usage:</p> <ul> <li> <p>Accepts only source selection rules, where <code>server-name</code> in the object locator matches the source data provider.</p> </li> <li> <p>Supports <code>explicit</code>, <code>include</code>, and <code>exclude</code> rule actions.</p> </li> </ul>

    Raises:
        capo_database_migration_service.errors.access_denied_fault.AccessDeniedFault: <p>DMS was denied access to the endpoint. Check that the role is correctly configured.</p>
        capo_database_migration_service.errors.invalid_resource_state_fault.InvalidResourceStateFault: <p>The resource is in a state that prevents it from being used for database migration.</p>
        capo_database_migration_service.errors.kms_key_not_accessible_fault.KMSKeyNotAccessibleFault: <p>DMS cannot access the KMS key.</p>
        capo_database_migration_service.errors.resource_already_exists_fault.ResourceAlreadyExistsFault: <p>The resource you are attempting to create already exists.</p>
        capo_database_migration_service.errors.resource_not_found_fault.ResourceNotFoundFault: <p>The resource could not be found.</p>
        capo_database_migration_service.errors.resource_quota_exceeded_fault.ResourceQuotaExceededFault: <p>The quota for this resource quota has been exceeded.</p>
        capo_database_migration_service.errors.s3_access_denied_fault.S3AccessDeniedFault: <p>Insufficient privileges are preventing access to an Amazon S3 object.</p>
        capo_database_migration_service.errors.s3_resource_not_found_fault.S3ResourceNotFoundFault: <p>A specified Amazon S3 bucket, bucket folder, or other object can't be found.</p>
        capo_database_migration_service.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Convert all objects in a schema
        The following example queues a conversion of all objects in the ExampleSchema schema to the target database format.

        >>> await client.start_metadata_model_conversion(migration_project_identifier='arn:aws:dms:us-east-1:111122223333:migration-project:EXAMPLEABCDEFGHIJKLMNOPQRS', selection_rules='{"rules": [{"rule-type": "selection","rule-id": "1","rule-name": "1","object-locator": {"server-name": "example-source-server.us-east-1.rds.amazonaws.com", "schema-name": "ExampleSchema"},"rule-action": "explicit"}]}')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_database_migration_service.types.start_metadata_model_conversion_message.StartMetadataModelConversionMessage]",
    ) -> AsyncOperationResponse[
        "capo_database_migration_service.types.start_metadata_model_conversion_response.StartMetadataModelConversionResponse"
    ]:
        import capo_database_migration_service._operations.amazon_dm_sv20160101.start_metadata_model_conversion

        (
            output,
            http_response,
        ) = await capo_database_migration_service._operations.amazon_dm_sv20160101.start_metadata_model_conversion.async_start_metadata_model_conversion(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartMetadataModelConversion")
    )
    input_: capo_database_migration_service.types.start_metadata_model_conversion_message.StartMetadataModelConversionMessage = {
        "migration_project_identifier": migration_project_identifier,
        "selection_rules": selection_rules,
    }

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