I tried to create node and relationship using gqlalchemy in neo4j as per the memgraph documentation but it did not worked
from gqlalchemy import Memgraph, Node, Relationship, Field,Neo4j
from typing import Optional
db = Neo4j(host="localhost", port="7687", username="neo4j", password="12345678")
class User(Node):
id: str = Field(index=True, exist=True, unique=True, db=db)
username: str = Field(index=True, exist=True, unique=True, db=db)
class Language(Node):
name: str = Field(unique=True, db=db)
user = User(id="3", username="John")
db.save_node(user)
language = Language(name="en")
db.save_node(user)
Got an error as
raise Neo4jError.hydrate(**metadata)
neo4j.exceptions.ClientError: {code: Neo.ClientError.Schema.IndexAlreadyExists} {message: There already exists an index (:User {id}). A constraint cannot be created until the index has been dropped.}