I am not sure how to use mergeE and mergeV using gremlin_python

I am using janusgraph with cassandra for my project and I want to implement upsert functionality. For that I didn't find much resources, only this gist (https://gist.github.com/spmallette/5cd448f38d5dae832c67d890b576df31) . From that, I wrote certain code which does work. The code looks like this
For vertex/node
g.merge_v({T.id: node.id}).option(
            Merge.on_create, {
                T.label: node.type.value,
                'name': node.name
            }
        ).option(
            Merge.on_match, {
                'name': node.name
            }
        ).property("full_name": node.full_name) \
        .next()

For edge
g.merge_e({T.label: edge.relationship.value,
                                    Direction.from_: edge.from_.id,
                                    Direction.to: edge.to_.id})\
                .option(Merge.on_create, {
                    T.label: edge.relationship.value
                }) \
                .option(Merge.on_match, {
                    'updated': "true"
                }).property("description": edge.description).next()

In the edge, I don't want an "updated" thing to be there but if I keep the dictionary empty for the options, it throws the error. Let me know if I am doing it wrong or not. Should I place the values in the .property() or should I keep the changes in the options?
Gist
Gremlin merge() API. GitHub Gist: instantly share code, notes, and snippets.
Was this page helpful?