© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Apache TinkerPopAT
Apache TinkerPop•3y ago•
7 replies
Manabu

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

    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()
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()
statics.long()
has fixed this issue.

from gremlin_python.statics import long
from gremlin_python.statics import long

Change
property("updatedOn", updatedOn)
property("updatedOn", updatedOn)
to
property("updatedOn", long(updatedOn))
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:
if obj < -9223372036854775808 or obj > 9223372036854775807:
obj is much smaller in my case than the range it compares.
Apache TinkerPop banner
Apache TinkerPopJoin
Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
1,376Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Getting Property Out of a Variable in Python Gremlin Query
Apache TinkerPopATApache TinkerPop / questions
3y ago
How to Work with Transactions with Gremlin Python
Apache TinkerPopATApache TinkerPop / questions
15mo ago
Using java/gremlin inside python with Jpype!
Apache TinkerPopATApache TinkerPop / questions
15mo ago
Gremlin python MergeV update properties
Apache TinkerPopATApache TinkerPop / questions
13mo ago