How can I index properties in the Node and Relationship classes I created in Memgraph with GQLAlchemy? Is it possible to create only a Label index?
Asked
Active
Viewed 39 times
1 Answers
0
Check out Memgraph's documentation. There are some great and simple examples that explain the process. For example,
from gqlalchemy import Memgraph, Node, Field
db = Memgraph()
class Animal(Node, index=True, db=db):
name: str
class Human(Node):
id: str = Field(index=True, db=db)
In the first class, Animal
, the class argument index
is set to True
. That means that Memgraph will create a label index
on the label Animal
.
The other class, Human
, has a Field()
index
argument set to True
. Hence, Memgraph will create a label-property index
on the property id
of every node labeled Human
.

MPesi
- 212
- 8