Skip to content

task: improve fetch of cardinality many relationship #475

@fatih-acar

Description

@fatih-acar

Component

Python SDK

Task Description

When having a relationship with high cardinality such as a Group with thousands of members, the SDK will try to fetch each member sequentially.

This small snippet against a Group with 700 members returns the following result:

from infrahub_sdk import InfrahubClientSync

client = InfrahubClientSync()

group = client.get(kind="CoreGraphQLQueryGroup", id="184c607c-60b0-0880-1474-10650c6107f7", prefetch_relationships=True)

group.members.fetch()
time python group.py

real    2m27.738s
user    0m41.120s
sys     0m0.389s

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/taskBody of work related to an epic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions