Closed Joacchim closed 10 years ago
The Bulbs Gremlin API has three methods: query()
, command()
, and execute()
. See...
Use the query()
method when you are returning vertices or edges -- as you have found, it returns an iterator that will initialize elements to appropriate Vertex, Edge, or Model class.
Use the command()
method when you issue a Gremlin command and expect a single return value in the response.
Use the execute()
method when you are returning anything else, such as a Gremlin script that returns a list of names, or in this case table data -- execute()
returns a generic Response
object:
>>> resp = g.gremlin.execute(script, params)
>>> resp.content # json content from server
See https://github.com/espeed/bulbs/blob/master/bulbs/neo4jserver/client.py#L219
Resolved AFAIK.
Thanks for the answer. I originally used the query() because I expected something to be returned, and got this exception when doing an unexpected request. I understand that the API has multiple entry points for different purposes, but I was surprised to get an exception.
If this is the expected behavior then yes, this was a non-issue. Thanks for your time !
Hello,
I'm not even sure it is either a bug or the wanted behavior, but I ended up getting a TypeError Exception from a gremlin query.
The query was ended by a ".fill(table)" operation, which in my understanding (after a bit of treasure hunting) leads to an empty response (with response.content != Null, with the dictionnary being "{u'data': [], u'columns': []}" )
I tried to check within the base code (initialize_elements function) as well as within the Neo4J client code (get_results method) how it is managed, but it seems that even when the reponse only contains one result which is not an iterable, it should work.
My guess is thus that the Result is built atop an empty content, and cannot be managed by the base code.
Here is the end of the stack trace given to me by python (I removed my own code):
This isn't a blocker at all, but I thought it was worth mentionning, in case it's an unintended behavior.
Thanks for thre Great Work !