Skip to content

provide a tool to collect and generate the pydantic ERD based on dataloader and schemas #150

@allmonday

Description

@allmonday

dataloader is a relationship to define and connect entities

if we provide enough information in dataloader (DRAFT)

class Loader(DataLoader):
    __relationships__ = {
        from: Company,
        from_key: user_id,
        to: User,
        relationship: '1 -> N, owns'
    }
    async def batch_load_fn(self, keys):
        ...

or defined in schema

class EntityA(BaseModel):
    __metadata__ = [
        { to: EntityB,  describe: "A.id == B.a_id",  loader: [] }
        { to: EntityC, func: Func }
    ]
    # a : obj
    # def resolve_a(self, loader)
    #      return loader.load(self.id)

then after collecting all Loaders, a Graph of ER can be generate.

It's a Doc

expected output, raw

image

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions