neo4j/neo4j-python-driver

Create an OGM with transparency and facilities just like Spring Data Neo4j but for Python

Closed this issue · 3 comments

Good morning,

I would like to create an OGM focused on cyhper but using the logic of the decorators that Spring Data Neo4j uses, having a @node class and another @RelationshipProperties class for the relationship with properties and going deeper little by little to create it more organized and using Neo4j in a cleaner and more transparent way from a python project as it is done from SpringBoot.

I would like to know if this idea is possible to carry out because I already started to program it.

Cordially greetings
If you can provide me with documentation or video conferences or video tutorials to carry out this project, I gladly accept and appreciate it.

Have you already watched Estelle's node's presentation? She lightly talks about Neomodel and Py2Neo before showing how she implemented a more object oriented approach. But it might give you some ideas and a place to start.

https://www.youtube.com/watch?v=DKziks5jQvc

Have you already watched Estelle's node's presentation? Her lightly talks about Neomodel and Py2Neo before showing how she implemented a more object oriented approach. But it might give you some ideas and a place to start.

https://www.youtube.com/watch?v=DKziks5jQvc

Yes, i see the video, and his have my like a days ago, i will see this video again

The video Jalakoo suggested would've also been my go-to recommendation. I imagine it might be a tad difficult (but probably not impossible) to only use decorators as you cannot decorate class attributes.

@node
class Person:
    friends  # how to tell the OGM how that relation ship is modeled?

You could maybe use type hints for that (not 100% sure if there's a way to do that without abusing type hints, i.e. if there's a way to do it that would still make a type-checker do the right thing) or just properly assign a class attribute.

type hint option

@node
class Person:
    friends: Relationship(meta_info=...)  # or similar (maybe need to work with subscription `friends: Relationship[...]`)

class attribute option

@node
class Person:
    friends = Relationship(meta_info=...)  # or similar

There are many paths to explore here and the question is a pretty open one but I'm looking very much forward to see what you'll come up with. I'll close the issue as there's not immediate action to take here for us. But please feel free to keep coming back to this issue if you get stuck along the way, have questions, or just want to let us know about your results!