neo4j-contrib/neomodel

Database introspection

mariusconjeaud opened this issue · 1 comments

It could be useful to have a script that can connect to a database, read the schema, and propose neomodel class definitions based on that.

I have written a first version of this that I will share soon.

It returns something like the below. Of course, it will have limitations, especially with multi-label nodes, and relationship cardinality. But this can be a good way to kickstart a neomodel project on top of an existing database

class Content(StructuredNode):
    updated = StringProperty()
    embedding = StringProperty()
    title = StringProperty()
    url = StringProperty()
    description = StringProperty()
    created = StringProperty()
    thumbnail = StringProperty()
    id = StringProperty()
    format = StringProperty()
    language = StringProperty()
    tagged = RelationshipTo(Keyword, "tagged")


class Author(StructuredNode):
    name = StringProperty(index=True)
    authored = RelationshipTo(Content, "authored")


class Keyword(StructuredNode):
    name = StringProperty(index=True)

Part of release 5.2.0