Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

eager loading relationships #62

@giulioprovasi

Description

@giulioprovasi

Is it possible to load the model with its relationships directly ? something like User.with('pictures') to avoid a huge callback chain ?

This example can be ok for one relationship, but what about models having 4 or 5 relationships depth:

def foundPicture(picture):
     print picture.file

def foundUser(user):
     user.picture.get().addCallback(foundPicture)

User.find(where=['first_name = ?', "Bob"], limit=1).addCallback(foundUser)

Imagine I have this structure: User [HAS_MANY] Picture [HAS_ONE] Path [HAS_ONE] descriptor (doesn't make sens, just to see how to do this correctly without running 4 queries)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions