or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

connection-configuration.mdfile-management.mdindex.mdmigration-task-types.mdproject-management.mdresource-information.mdservice-management.mdservice-tasks.mdtask-execution.md
tile.json

tessl/pypi-azure-mgmt-datamigration

Azure Data Migration Client Library for programmatically managing database migration services and operations.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-mgmt-datamigration@10.0.x

To install, run

npx @tessl/cli install tessl/pypi-azure-mgmt-datamigration@10.0.0

index.mddocs/

Azure Data Migration Management Client

A comprehensive Python client library for Microsoft Azure Data Migration services, implementing Azure Resource Manager (ARM) APIs for managing database migration operations. This library enables developers to programmatically create, configure, and monitor data migration projects and services within the Azure ecosystem, supporting various database migration scenarios including SQL Server to Azure SQL Database, MySQL migrations, Oracle to PostgreSQL, and MongoDB migrations.

Package Information

  • Package Name: azure-mgmt-datamigration
  • Language: Python
  • Installation: pip install azure-mgmt-datamigration
  • Dependencies: azure-mgmt-core, msrest, azure-common
  • License: MIT

Core Imports

from azure.mgmt.datamigration import DataMigrationManagementClient

For async operations:

from azure.mgmt.datamigration.aio import DataMigrationManagementClient

Common models and types:

from azure.mgmt.datamigration.models import (
    DataMigrationService,
    Project,
    ProjectTask,
    SqlConnectionInfo,
    MySqlConnectionInfo,
    PostgreSqlConnectionInfo,
    MongoDbConnectionInfo
)

Basic Usage

from azure.identity import DefaultAzureCredential
from azure.mgmt.datamigration import DataMigrationManagementClient

# Create the client
credential = DefaultAzureCredential()
client = DataMigrationManagementClient(
    credential=credential,
    subscription_id="your-subscription-id"
)

# List migration services
services = client.services.list()
for service in services:
    print(f"Service: {service.name}, Location: {service.location}")

# Get service details
service = client.services.get(
    group_name="myResourceGroup",
    service_name="myMigrationService"
)

# List projects in a service
projects = client.projects.list(
    group_name="myResourceGroup",
    service_name="myMigrationService"
)

# Create a new migration project
from azure.mgmt.datamigration.models import Project

project_params = Project(
    location="eastus",
    source_platform="SQL",
    target_platform="SQLDB"
)

project = client.projects.create_or_update(
    group_name="myResourceGroup",
    service_name="myMigrationService",
    project_name="myProject",
    parameters=project_params
)

print(f"Created project: {project.name}")

Architecture

The Azure Data Migration Management Client follows Azure Resource Manager patterns and provides:

  • Client Classes: Main entry points (sync/async) for all operations
  • Operation Groups: Logical groupings of related functionality (services, projects, tasks, files)
  • Models: Comprehensive data structures for all migration scenarios and configurations
  • Connection Info: Database-specific connection classes for various platforms
  • Task Properties: Specialized classes for different migration and validation operations
  • Long-Running Operations: Support for Azure ARM polling patterns for time-intensive operations

The library abstracts the complexity of Azure's Data Migration Service REST APIs while providing full access to advanced migration features, monitoring capabilities, and multi-database platform support.

Capabilities

Service Management

Core operations for managing Azure Data Migration Service instances, including creation, configuration, lifecycle management, and monitoring.

# Key service operations
def begin_create_or_update(group_name: str, service_name: str, parameters: DataMigrationService) -> LROPoller[DataMigrationService]: ...
def get(group_name: str, service_name: str) -> DataMigrationService: ...
def begin_delete(group_name: str, service_name: str) -> LROPoller[None]: ...
def begin_start(group_name: str, service_name: str) -> LROPoller[None]: ...
def begin_stop(group_name: str, service_name: str) -> LROPoller[None]: ...
def list() -> ItemPaged[DataMigrationService]: ...

Service Management

Project Management

Operations for managing migration projects within Data Migration services, organizing related migration tasks and configurations.

# Key project operations
def create_or_update(group_name: str, service_name: str, project_name: str, parameters: Project) -> Project: ...
def get(group_name: str, service_name: str, project_name: str) -> Project: ...
def delete(group_name: str, service_name: str, project_name: str) -> None: ...
def list(group_name: str, service_name: str) -> ItemPaged[Project]: ...

Project Management

Task Execution

Execute and manage various migration and validation tasks including connection testing, schema migration, data migration, and assessment operations.

# Key task operations
def create_or_update(group_name: str, service_name: str, project_name: str, task_name: str, parameters: ProjectTask) -> ProjectTask: ...
def get(group_name: str, service_name: str, project_name: str, task_name: str) -> ProjectTask: ...
def cancel(group_name: str, service_name: str, project_name: str, task_name: str) -> ProjectTask: ...
def command(group_name: str, service_name: str, project_name: str, task_name: str, parameters: CommandProperties) -> CommandProperties: ...

Task Execution

Connection Configuration

Database connection classes and configuration for various source and target platforms including SQL Server, MySQL, Oracle, PostgreSQL, and MongoDB.

# Connection info classes
class SqlConnectionInfo(ConnectionInfo): ...
class MySqlConnectionInfo(ConnectionInfo): ...
class PostgreSqlConnectionInfo(ConnectionInfo): ...
class OracleConnectionInfo(ConnectionInfo): ...
class MongoDbConnectionInfo(ConnectionInfo): ...

Connection Configuration

Migration Task Types

Specialized task property classes for different migration scenarios, validation operations, and database-specific migration workflows.

# SQL Server migration tasks
class MigrateSqlServerSqlDbTaskProperties(ProjectTaskProperties): ...
class MigrateSqlServerSqlMITaskProperties(ProjectTaskProperties): ...

# MySQL migration tasks  
class MigrateMySqlAzureDbForMySqlOfflineTaskProperties(ProjectTaskProperties): ...
class MigrateMySqlAzureDbForMySqlSyncTaskProperties(ProjectTaskProperties): ...

# Oracle migration tasks
class MigrateOracleAzureDbForPostgreSqlSyncTaskProperties(ProjectTaskProperties): ...

Migration Task Types

File Management

Operations for managing project files including migration scripts, configuration files, and other migration assets.

# Key file operations
def create_or_update(group_name: str, service_name: str, project_name: str, file_name: str, parameters: ProjectFile) -> ProjectFile: ...
def get(group_name: str, service_name: str, project_name: str, file_name: str) -> ProjectFile: ...
def read(group_name: str, service_name: str, project_name: str, file_name: str) -> FileStorageInfo: ...

File Management

Service Tasks

Service-level tasks that operate independently of specific projects, including driver management and service-wide operations.

# Key service task operations  
def create_or_update(group_name: str, service_name: str, task_name: str, parameters: ProjectTask) -> ProjectTask: ...
def get(group_name: str, service_name: str, task_name: str) -> ProjectTask: ...
def cancel(group_name: str, service_name: str, task_name: str) -> ProjectTask: ...

Service Tasks

Resource Information

Operations for retrieving resource usage, quotas, available SKUs, and API operation information.

# Resource information operations
def list_skus() -> ItemPaged[ResourceSku]: ...  # Available SKUs
def list() -> ItemPaged[Quota]: ...  # Usage quotas
def list() -> ItemPaged[ServiceOperation]: ...  # Available operations

Resource Information

Common Types

Core Resource Types

class DataMigrationService:
    """Azure Data Migration Service resource."""
    def __init__(self, location: str, **kwargs): ...
    
    # Properties
    location: str
    kind: str
    sku: ServiceSku
    provisioning_state: str
    public_key: str

class Project:
    """Migration project resource."""
    def __init__(self, location: str, source_platform: str, target_platform: str, **kwargs): ...
    
    # Properties
    location: str
    source_platform: str  # SQL, MySQL, PostgreSQL, MongoDb, Oracle
    target_platform: str  # SQLDB, SQLMI, AzureDbForMySql, AzureDbForPostgreSql, MongoDb
    source_connection_info: ConnectionInfo
    target_connection_info: ConnectionInfo
    databases_info: List[DatabaseInfo]

class ProjectTask:
    """Migration or validation task."""
    def __init__(self, properties: ProjectTaskProperties, **kwargs): ...
    
    # Properties
    etag: str
    properties: ProjectTaskProperties
    task_type: str
    
class ProjectTaskProperties:
    """Base class for task properties."""
    # Properties
    errors: List[ODataError]
    state: str  # Unknown, Queued, Running, Canceled, Succeeded, Failed, etc.  
    commands: List[CommandProperties]
    client_data: Dict[str, Any]

Connection Information Base Types

class ConnectionInfo:
    """Base connection information."""
    def __init__(self, type: str, **kwargs): ...
    
    # Properties
    type: str
    user_name: str
    password: str

Error and Result Types

class DataMigrationError:
    """Migration error information."""
    message: str
    type: str

class ODataError:
    """OData error response."""
    code: str
    message: str
    target: str
    details: List[ODataError]

class MigrationValidationResult:
    """Migration validation results."""
    id: str
    migration_id: str
    summary_result: MigrationValidationDatabaseSummaryResult
    status: str