'Create table in dynamoDB(pynamoDB) with following model , but here 2nd class(Ran) is a attr in 1st class and 3rd class(Ran2) used as attr in 2nd

class MigrationPlan:
    name: str [primary key]
    asgs: List[Ran]

class Ran:
    random_id: str [primary key]
    old_asg_id: str [range key]
    old_asg: Ran2
    new_asg: Ran2
    order_id: int
    order_arrived: bool
    scaling_disabled: bool

class Ran2:
    asg_id: str [primary key]
    instance_type: str
    instance_count: int
    current_instance_count: int
    asg_created: bool
    hosts_arrived: bool
    hosts_transferred: bool
    scaling_planner_status: str
    migrate_service_workflow: Optional[str]

Here MigrationPlan class contains Ran as an attribute which is another class and similarly class Ran contains attributes as Ran2 which is again another class.How can I do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source