Sorry if this question is too stupid to ask... I am a newbie on Python+Django+Bulbs+Neo4j.
I am attempting --without success-- to get an integer produced by g.gremlin.execute() while using Python+Django shell, as detailed below.
First, the query in Neo4j's Gremlin console:
gremlin> g.v(2).out
==> v[6]
==> v[4]
==> v[8]
==> v[7]
gremlin> g.v(2).out.count()
==> 4
What I intend to do it to get this result in Python+Django shell, passing it to a variable, as tried below:
>>> from bulbs.neo4jserver import Graph
>>> from bulbs.model import Node,Relationship
>>> g = Graph()
>>> sc = " g.v(vertex_id).out.count()"
>>> params = dict(vertex_id = 2)
>>> val = g.gremlin.execute(sc,params)
>>> val
<bulbs.neo4jserver.client.Neo4jResponse object at 0x243cfd0>
I can't get any further from now on.
>>> val.one()
<bulbs.neo4jserver.client.Neo4jResult object at 0x2446b90>
>>> val.one().data
>>> val.one().results
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'Neo4jResult' object has no attribute 'results'
Could anyone please tell me what am I doing wrong? Many thanks!
Raw result data is going to be in the Result object's
raw
attribute:NOTE:
result.data
returns an element's property data, so it will be empty unless you are returning a vertex or edge, i.e. a node or relationship in Neo4j parlance.See...
To see what Neo4j Server returned in the server response, you can output the
Response
headers and content:And if you set the loglevel to
DEBUG
inConfig
, you'll be able to see what's being sent to the server on each request. WhenDEBUG
is enabled, Bulbs also sets theraw
attribute on theResponse
object (not to be confused with theraw
attribute that is always set on theResult
object).Response.raw
will contain the raw server response:See...
To turn off
DEBUG
, set the loglevel back toERROR
:See...