Queues the creation of a metadata model in the source metadata tree. If other requests created by Start* operations are already in the migration project's queue, the creation begins after they complete.
This operation supports only Microsoft SQL Server to Aurora PostgreSQL and Microsoft SQL Server to Amazon RDS for PostgreSQL conversion paths.
To check the status of the creation request, call DescribeMetadataModelCreations using the returned RequestIdentifier as a filter.
To cancel a queued or in-progress request, call CancelMetadataModelCreation with the returned RequestIdentifier.
Calling StartMetadataModelImport with Refresh deletes metadata models created by this operation.
After the creation completes successfully:
Required permissions: dms:StartMetadataModelCreation. 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 source schema for the metadata model. 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 only explicit rule actions.
-
Exactly one rule is allowed.
-
metadata_model_name
(String)
–
The name for the metadata model to use in subsequent operations.
-
properties
(MetadataModelProperties)
–
The properties of the metadata model.
Raises:
Examples:
Create a metadata model for a SQL statement
The following example queues the creation of a metadata model for a SQL statement. The selection rule specifies the schema where the metadata model is placed, and MetadataModelName provides a unique identifier for use in subsequent operations.
>>> await client.start_metadata_model_creation(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", "database-name": "ExampleDatabase", "schema-name": "ExampleSchema"}, "rule-action": "explicit"}]}', metadata_model_name='ExampleStatement', properties={'StatementProperties': {'Definition': 'SELECT * FROM ExampleTable;'}})
Source code in docs_src/capo_database_migration_service/_services/async_database_migration_service.py
| async def start_metadata_model_creation(
self,
migration_project_identifier: "capo_database_migration_service.types.migration_project_identifier.MigrationProjectIdentifier",
selection_rules: "capo_database_migration_service.types.string.String",
metadata_model_name: "capo_database_migration_service.types.string.String",
properties: "capo_database_migration_service.types.metadata_model_properties.MetadataModelProperties",
*,
config_overrides: Optional[AsyncDatabaseMigrationServiceClientConfig] = None,
) -> "capo_database_migration_service.types.start_metadata_model_creation_response.StartMetadataModelCreationResponse":
"""<p>Queues the creation of a metadata model in the source metadata tree. If other requests created by <code>Start*</code> operations are already in the migration project's queue, the creation begins after they complete.</p> <note> <p>This operation supports only Microsoft SQL Server to Aurora PostgreSQL and Microsoft SQL Server to Amazon RDS for PostgreSQL conversion paths.</p> </note> <p>To check the status of the creation request, call <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_DescribeMetadataModelCreations.html">DescribeMetadataModelCreations</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_CancelMetadataModelCreation.html">CancelMetadataModelCreation</a> with the returned <code>RequestIdentifier</code>.</p> <important> <p>Calling <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_StartMetadataModelImport.html">StartMetadataModelImport</a> with <code>Refresh</code> deletes metadata models created by this operation.</p> </important> <p>After the creation completes successfully:</p> <ul> <li> <p>To evaluate conversion complexity, call <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_StartMetadataModelAssessment.html">StartMetadataModelAssessment</a>.</p> </li> <li> <p>To convert to the target database format, call <a href="https://docs.aws.amazon.com/dms/latest/APIReference/API_StartMetadataModelConversion.html">StartMetadataModelConversion</a>.</p> </li> </ul> <p> <b>Required permissions:</b> <code>dms:StartMetadataModelCreation</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 source schema for the metadata model. 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 only <code>explicit</code> rule actions.</p> </li> <li> <p>Exactly one rule is allowed.</p> </li> </ul>
metadata_model_name: <p>The name for the metadata model to use in subsequent operations.</p>
properties: <p>The properties of the metadata model.</p>
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.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.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Create a metadata model for a SQL statement
The following example queues the creation of a metadata model for a SQL statement. The selection rule specifies the schema where the metadata model is placed, and MetadataModelName provides a unique identifier for use in subsequent operations.
>>> await client.start_metadata_model_creation(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", "database-name": "ExampleDatabase", "schema-name": "ExampleSchema"}, "rule-action": "explicit"}]}', metadata_model_name='ExampleStatement', properties={'StatementProperties': {'Definition': 'SELECT * FROM ExampleTable;'}})
"""
async def _handler(
req: "AsyncOperationRequest[capo_database_migration_service.types.start_metadata_model_creation_message.StartMetadataModelCreationMessage]",
) -> AsyncOperationResponse[
"capo_database_migration_service.types.start_metadata_model_creation_response.StartMetadataModelCreationResponse"
]:
import capo_database_migration_service._operations.amazon_dm_sv20160101.start_metadata_model_creation
(
output,
http_response,
) = await capo_database_migration_service._operations.amazon_dm_sv20160101.start_metadata_model_creation.async_start_metadata_model_creation(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("StartMetadataModelCreation")
)
input_: capo_database_migration_service.types.start_metadata_model_creation_message.StartMetadataModelCreationMessage = {
"migration_project_identifier": migration_project_identifier,
"selection_rules": selection_rules,
"metadata_model_name": metadata_model_name,
"properties": properties,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|