Modelling using OGM

Create Vertex Model

1
from invana.ogm import models, fields
2
​
3
​
4
graph = InvanaGraph("ws://megamind-ws:8182/gremlin", traversal_source="g")
5
​
6
​
7
class Project(models.VertexModel):
8
graph = graph
9
properties = {
10
'name': fields.StringProperty(max_length=10, trim_whitespaces=True),
11
'description': fields.StringProperty(allow_null=True, min_length=10),
12
'rating': fields.FloatProperty(allow_null=True),
13
'is_active': fields.BooleanProperty(default=True),
14
'created_at': fields.DateTimeProperty(default=lambda: datetime.now())
15
}
16
Copied!
Copy link
Edit on GitHub