Solved: Gremlin Python Exceptions with .property("timeStamp", 0)

The Issue:

In the Python code below:

def create_edge(self, from_v: Vertex, to_v: Vertex, edge_label: str, related_as: str, updated_by_uuid: str = INebulaGraph.uuid_system) -> Edge: uuid = DateAndUuidUtils.uuid_generate() now = DateAndUuidUtils.datetime_of_now() updated_on = DateAndUuidUtils.java_epoch_of(now) updated_on_str = DateAndUuidUtils.datetime_to_iso(now) created_edge: Edge = self.g.add_e(edge_label). \ from_(from_v).to(to_v). \ property("name", ""). \ property("updatedOn", updatedOn). \ property("updatedOnStr", updated_on_str). \ property("relatedAs", related_as). \ property("updatedBy", updated_by_uuid). \ property("uuid", uuid). \ next() return created_edge

Where my DateAndUuidUtils.datetime_of_now() returns a python (int) of the Java Epoch value via datatime(). When above code is executed it exceptions by the underlying code saying that the value is too big and use gremlin bigint.

Solved:

Using statics.long() has fixed this issue.

from gremlin_python.statics import long
Change property("updatedOn", updatedOn) to property("updatedOn", long(updatedOn))

Additional Note:

  • A double value goes in without any problem. It is only python int() into Gremlin.
  • I would hope the error message can be a bit more friendly as to what I can do.
  • The compare code in graphbinaryV1.py:dictify looks buggy, it's comparing the range much bigger than the long value.
    if obj < -9223372036854775808 or obj > 9223372036854775807: obj is much smaller in my case than the range it compares.
Was this page helpful?