I'm trying to start a project using Neo4j Aura and neomodel. I've found this post and set up my connection as suggested, however when I try to run my project I get the following error:
ValueError: Expecting url format: bolt://user:password@localhost:7687 got neo4j+s://myuser:mypass@mydb.databases.neo4j.io
I've checked the neomodel code and it specifically checks for the bolt protocol and won't continue with the neo4j+s protocol. This differs from what is suggested in the post I linked - am I missing something? I would greatly appreciate a hint in the right direction.
Here is the example code I'm trying to run:
import os
from neomodel import (config, StructuredNode, StringProperty, IntegerProperty,
UniqueIdProperty, RelationshipTo)
from dotenv import load_dotenv
if __name__ == '__main__':
load_dotenv()
user = os.environ['NEO4J_USERNAME']
psw = os.environ['NEO4J_PASSWORD']
uri = os.environ['NEO4J_URI']
config.DATABASE_URL = 'neo4j+s://{}:{}@{}'.format(user, psw, uri)
class Country(StructuredNode):
code = StringProperty(unique_index=True, required=True)
class Person(StructuredNode):
uid = UniqueIdProperty()
name = StringProperty(unique_index=True)
age = IntegerProperty(index=True, default=0)
# traverse outgoing IS_FROM relations, inflate to Country objects
country = RelationshipTo(Country, 'IS_FROM')
jim = Person(name='Jim', age=3).save() # Create
jim.age = 4
jim.save() # Update, (with validation)
Please advise your neo4j version and neo4j driver version. Bolt protocol is previously used in neo4j drivers 1.7 while neo4j protocol is for neo4j version 4.x. This protocol neo4j+s is equivalent to bolt+routing in older version. Then, I tried your code and it is working well. Notice the db aura uri at the bottom of the image.
To check your neo4j versions, open a terminal and type "pip freeze | grep neo4j". This is my driver version:
neo4j==4.4.5
neo4j-driver==4.3.6
neomodel==4.0.8