Search code examples
python-3.xneo4jneomodel

Check the type of a property in neomodel


Is it possible to get the type of a property in neomodel? For example something like this:

for n in MyNodeModel.properties: 
    if n == StructuredNode:
        print('StructuredNode')

I hope my questions is clear...


Solution

  • Sure you just need to get the property object from the model:

    if isinstance(MyNodeModel.your_property, StringProperty):
        print("a string")
    

    If this doesn't answer your question please open an issue on github