neo4j-contrib/neomodel

neomodel_inspect_database RelationshipTo model as string

Opened this issue · 1 comments

Expected Behavior (Mandatory)

The model parameter should be assigned an object, not a string.

belongs_to = RelationshipTo("Marketing", "BELONGS_TO", cardinality=OneOrMore, model=BelongsToRel)

Actual Behavior (Mandatory)

The current script generates a string for the model parameter.

belongs_to = RelationshipTo("Marketing", "BELONGS_TO", cardinality=OneOrMore, model="BelongsToRel")

How to Reproduce the Problem

$ neomodel_inspect_database -db bolt://neo4j_username:neo4j_password@localhost:7687 --write-to yourapp/models.py

Simple Example

Datasets and Statements

Screenshots (where it's possibile)

Specifications (Mandatory)

Currently used versions

Versions

  • OS: MacOS 14.5 (23F79)
  • Library: neomodel
  • Neo4j: 5.19

That is done on purpose, because the model that the RelationshipTo refers to is actually defined after the node itself. So if you pass an object, your class file will not like it and you would have to reorder, or turn into a string yourself anyway.
So I though I should make it a string straight away.

But, if you think it makes more sense, I could make sure that relationship models are always defined before any nodes ; or I don't pass it a string and let users fix the model as they see fit ?