Skip to content

Create node with an attribute value None #11

@sara-02

Description

@sara-02

I have certain attributes in my dictionary whose value is None, but I am unable to add those as an attribute in my graph
Example

>>>a= {"name":"package.json", "label":"package", "source":None}
>>>graph.create(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/gremlinrestclient/graph.py", line 182, in create
    return self._create(script, bindings)
  File "/usr/lib/python2.7/site-packages/gremlinrestclient/graph.py", line 185, in _create
    resp = self.execute(script, bindings=bindings)
  File "/usr/lib/python2.7/site-packages/gremlinrestclient/client.py", line 40, in execute
    resp = self._post(self._url, json.dumps(payload))
  File "/usr/lib/python2.7/site-packages/gremlinrestclient/client.py", line 59, in _post
    raise GremlinServerError(resp.status_code, msg)
gremlinrestclient.exceptions.GremlinServerError: Code [500]: SERVER_ERROR. A general server error occurred that prevented the request from being processed..

Error encountered evaluating script: v16 = graph.addVertex(label, p0, 'source', p1, 'name', p2, );[[v16], []];

When I changed the source = "" it worked.

>>> a= {"name":"package.json", "label":"package", "source":""}
>>> graph.create(a)
Collection(vertices=(Vertex(id=16480, label=u'package', properties={u'source': [{u'id': u'4r0-cps-hdx', u'value': u''}], u'name': [{u'id': u'558-cps-1l1', u'value': u'package.json'}]}),), edges=())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions