File size: 922 Bytes
585bc48 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # 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 |