Executor / pydantic_migration_model.py
Soumik Bose
go
585bc48
Raw
History Blame Contribute Delete
922 Bytes
# pydantic_migration_model.py
from pydantic import BaseModel, Field
from typing import List, Optional, Union, Dict, Any
class MigrationRequest(BaseModel):
db_url: str = Field(..., description="The connection string for the target database")
db_type: str = Field(..., description="postgres, mysql, or mongodb")
# For SQL Databases, this is the raw SQL Script (CREATE + INSERT)
# For MongoDB, this is ignored (we use migration_data)
migration_query: Optional[str] = None
# For MongoDB, we pass the raw JSON documents to insert
# For SQL, this is ignored
migration_data: Optional[List[Dict[str, Any]]] = None
# Metadata for MongoDB
collection_name: Optional[str] = None
# Options
batch_size: int = 1000
class MigrationResponse(BaseModel):
success: bool
rowsProcessed: int
errors: Optional[List[str]] = []
duration: str
request_id: str