neo4j-contrib / neomodel

An Object Graph Mapper (OGM) for the Neo4j graph database.
https://neomodel.readthedocs.io
MIT License
939 stars 231 forks source link

Failed creating nodes to neo4j aura #764

Closed ppalka-lingaro closed 3 months ago

ppalka-lingaro commented 10 months ago

Expected Behavior (Mandatory)

Connect to neo4j aura and creation of nodes and relationship using neomodel not get any error config.DATABASE_URL = 'neo4j+s://{}:{}@{}'.format(user, password, uri) neo4j+s://neo4j:password@aura_instance.databases.neo4j.io:7687

Actual Behavior (Mandatory)

writing or connection failed ERROR: after 1st execution Failed to write data to connection ResolvedIPv4Address(('XX.XX.XX.XX', 7687)) (ResolvedIPv4Address(('XX.XX.XX.XX', 7687))) Failed to write data to connection IPv4Address(('aura_instance.databases.neo4j.io', 7687)) (ResolvedIPv4Address(('XX.XX.XX.XX', 7687)))

after second execution, looks that nodes where created but why after 1st time it's failing with this error neomodel.exceptions.UniqueProperty: Node(1381) already exists with label Person and property name = 'John'

How to Reproduce the Problem

  1. create aura instance on neo4j page
  2. connect using neomodel

Simple Example

class Person(StructuredNode): name = StringProperty(unique_index=True) knows = RelationshipTo('Person', 'KNOWS')

john = Person(name='John').save() jane = Person(name='Jane').save()

Create a relationship

john.knows.connect(jane)

Datasets and Statements

I tested connection using cypher-shell -a neo4j+s://aura_instance.databases.neo4j.io -u neo4j -p password Connected to Neo4j using Bolt protocol version 5.3 at neo4j+s://aura_instance.databases.neo4j.io:7687 as user neo4j.

also before was using native neo4j driver and all was working

Screenshots (where it's possible)

Specifications (Mandatory)

Currently used versions

Versions

mariusconjeaud commented 10 months ago

Hello,

From your message, I get you did manage to connect to Aura using neomodel, right ? It's writing the node that is causing issues. Also, we do test connection to Aura in our integrations test, with all four available protocols, and all supported Python versions 3.7 -> 3.11 (note we do not support Python 3.12 yet)

Just in case, can you add this in your code, before trying to connect ?

from neo4j.debug import watch
with watch("neo4j"):
    # Connect and query

This should output more information about the driver status