memgraph / gqlalchemy

GQLAlchemy is a library developed with the purpose of assisting in writing and running queries on Memgraph. GQLAlchemy supports high-level connection to Memgraph as well as modular query builder.
https://pypi.org/project/gqlalchemy/
Apache License 2.0
217 stars 32 forks source link

Add the possibility of partial loading #115

Open katarinasupe opened 2 years ago

katarinasupe commented 2 years ago

Related to the discussion at https://github.com/memgraph/gqlalchemy/issues/79.

Suppose we have a node defined:

class Stream(Node, labels={"User", "Stream"}):
    name: str = Field(index=True, unique=True, db=memgraph, label="User")
    id: str = Field(index=True, unique=True, db=memgraph)
    url: str = Field()
    followers: int = Field()
    createdAt: str = Field()
    totalViewCount: int = Field()
    description: str = Field()

And that we want to load all nodes that have followers = 500 from the database.

Something like:

streamers = memgraph.load_node_partial(Stream(followers=500))

Then streamers would be a list of all Stream nodes that have property followers set to 500. Then it won't be important that other properties are Optional and it is possible to get a list of matching streamers.

matea16 commented 5 months ago

+1 from the community, source