CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-datamigration

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

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

project-management.mddocs/

Project Management

Operations for managing migration projects within Data Migration services. Projects organize related migration tasks and maintain configuration for source and target database connections, serving as logical containers for migration workflows.

Capabilities

Create or Update Project

Creates a new migration project or updates an existing one within a Data Migration Service.

def create_or_update(
    group_name: str,
    service_name: str,
    project_name: str,
    parameters: Project,
    **kwargs
) -> Project:
    """
    Creates or updates a migration project.
    
    Parameters:
    - group_name: Name of the resource group
    - service_name: Name of the Data Migration Service
    - project_name: Name of the project
    - parameters: Project configuration and properties
    
    Returns:
    Project object with current state and configuration
    """

Usage Example:

from azure.mgmt.datamigration.models import (
    Project, 
    SqlConnectionInfo,
    DatabaseInfo
)

# Configure source connection
source_connection = SqlConnectionInfo(
    server_name="source-server.database.windows.net",
    database_name="SourceDB",
    user_name="sa",
    password="password123",
    authentication="SqlAuthentication",
    encrypt_connection=True,
    trust_server_certificate=False
)

# Configure target connection  
target_connection = SqlConnectionInfo(
    server_name="target-server.database.windows.net",
    database_name="TargetDB", 
    user_name="targetuser",
    password="targetpass123",
    authentication="SqlAuthentication",
    encrypt_connection=True,
    trust_server_certificate=False
)

# Create project
project_params = Project(
    location="eastus",
    source_platform="SQL",
    target_platform="SQLDB",
    source_connection_info=source_connection,
    target_connection_info=target_connection,
    databases_info=[
        DatabaseInfo(source_database_name="SourceDB")
    ]
)

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

print(f"Project {project.name} created successfully")

Get Project

Retrieves details of an existing migration project.

def get(
    group_name: str,
    service_name: str,
    project_name: str,
    **kwargs
) -> Project:
    """
    Gets a migration project.
    
    Parameters:
    - group_name: Name of the resource group
    - service_name: Name of the Data Migration Service
    - project_name: Name of the project
    
    Returns:
    Project object with current configuration and state
    """

Delete Project

Deletes a migration project and all associated tasks and files.

def delete(
    group_name: str,
    service_name: str,
    project_name: str,
    delete_running_tasks: Optional[bool] = None,
    **kwargs
) -> None:
    """
    Deletes a migration project.
    
    Parameters:
    - group_name: Name of the resource group
    - service_name: Name of the Data Migration Service  
    - project_name: Name of the project
    - delete_running_tasks: Whether to delete running tasks
    
    Returns:
    None
    """

Update Project

Updates properties of an existing migration project.

def update(
    group_name: str,
    service_name: str,
    project_name: str,
    parameters: Project,
    **kwargs
) -> Project:
    """
    Updates a migration project.
    
    Parameters:
    - group_name: Name of the resource group
    - service_name: Name of the Data Migration Service
    - project_name: Name of the project
    - parameters: Updated project properties
    
    Returns:
    Updated Project object
    """

List Projects

Lists all migration projects within a Data Migration Service.

def list(
    group_name: str,
    service_name: str,
    **kwargs
) -> ItemPaged[Project]:
    """
    Lists migration projects in a Data Migration Service.
    
    Parameters:
    - group_name: Name of the resource group
    - service_name: Name of the Data Migration Service
    
    Returns:
    Paged collection of Project objects
    """

Usage Example:

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

for project in projects:
    print(f"Project: {project.name}")
    print(f"  Source: {project.source_platform}")
    print(f"  Target: {project.target_platform}") 
    print(f"  State: {project.provisioning_state}")

Project Configuration Types

Project

class Project:
    """Migration project resource definition."""
    
    def __init__(
        self,
        location: str,
        source_platform: str,
        target_platform: str,
        **kwargs
    ):
        """
        Initialize migration project.
        
        Parameters:
        - location: Azure region for the project
        - source_platform: Source database platform
        - target_platform: Target database platform
        - source_connection_info: Source database connection
        - target_connection_info: Target database connection
        - databases_info: List of databases to migrate
        """
    
    # Properties
    location: str  # Required: Azure region
    source_platform: str  # Source platform (SQL, MySQL, PostgreSQL, MongoDb, Oracle, Unknown)
    target_platform: str  # Target platform (SQLDB, SQLMI, AzureDbForMySql, AzureDbForPostgreSql, MongoDb, Unknown)
    source_connection_info: ConnectionInfo  # Source database connection
    target_connection_info: ConnectionInfo  # Target database connection
    databases_info: List[DatabaseInfo]  # Databases to migrate
    provisioning_state: str  # Current provisioning state
    creation_time: datetime  # Project creation timestamp
    id: str  # Resource ID
    name: str  # Resource name
    type: str  # Resource type
    etag: str  # Entity tag for concurrency control
    tags: Dict[str, str]  # Resource tags

Database Configuration Types

class DatabaseInfo:
    """Database information for migration."""
    
    def __init__(self, source_database_name: str, **kwargs):
        """
        Parameters:
        - source_database_name: Name of source database
        - target_database_name: Name of target database (optional)
        """
    
    # Properties
    source_database_name: str  # Required: Source database name
    target_database_name: str  # Target database name (defaults to source name)

class DatabaseSummaryResult:
    """Database migration summary."""
    
    # Properties
    size_mb: float  # Database size in MB
    name: str  # Database name
    state: str  # Migration state
    stage: str  # Migration stage
    started_on: datetime  # Migration start time
    ended_on: datetime  # Migration end time
    message: str  # Status message

Platform Support

Supported Source Platforms

  • SQL: SQL Server (on-premises, Azure VM, Amazon RDS)
  • MySQL: MySQL Server (on-premises, Amazon RDS, Google Cloud SQL)
  • PostgreSQL: PostgreSQL Server (on-premises, Amazon RDS, Google Cloud SQL)
  • Oracle: Oracle Database (on-premises, Oracle Cloud)
  • MongoDb: MongoDB (on-premises, MongoDB Atlas, Amazon DocumentDB)

Supported Target Platforms

  • SQLDB: Azure SQL Database
  • SQLMI: Azure SQL Managed Instance
  • AzureDbForMySql: Azure Database for MySQL
  • AzureDbForPostgreSql: Azure Database for PostgreSQL
  • MongoDb: Azure Cosmos DB (MongoDB API)

Common Platform Combinations

# SQL Server to Azure SQL Database
Project(
    source_platform="SQL",
    target_platform="SQLDB",
    # ... other parameters
)

# MySQL to Azure Database for MySQL
Project(
    source_platform="MySQL", 
    target_platform="AzureDbForMySql",
    # ... other parameters  
)

# Oracle to Azure Database for PostgreSQL
Project(
    source_platform="Oracle",
    target_platform="AzureDbForPostgreSql", 
    # ... other parameters
)

# MongoDB to Azure Cosmos DB
Project(
    source_platform="MongoDb",
    target_platform="MongoDb",
    # ... other parameters
)

Error Handling

Project operations may encounter these common issues:

  • Invalid platform combinations: Not all source/target combinations are supported
  • Connection validation errors: Source or target connection information is incorrect
  • Resource conflicts: Project name already exists within the service
  • Permission errors: Insufficient permissions to access source or target databases

Always validate connection information before creating projects and ensure that the source and target platforms are compatible for your migration scenario.

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-datamigration

docs

connection-configuration.md

file-management.md

index.md

migration-task-types.md

project-management.md

resource-information.md

service-management.md

service-tasks.md

task-execution.md

tile.json