Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypher stats #163

Open
stefanli opened this issue Jun 30, 2015 · 3 comments
Open

Cypher stats #163

stefanli opened this issue Jun 30, 2015 · 3 comments

Comments

@stefanli
Copy link

More of a feature request than a bug.

Currently if you do a MATCH and SET without a RETURN statement in a cypher query it is not possible to know whether the SET was successful or not (e.g. due to a failed match). The REST API has a "stats" field that contains this information e.g:

{
"results": [{
"columns": [],
"data": [],
"stats": {
"contains_updates": true,
"nodes_created": 1,
"nodes_deleted": 0,
"properties_set": 1,
"relationships_created": 0,
"relationship_deleted": 0,
"labels_added": 1,
"labels_removed": 0,
"indexes_added": 0,
"indexes_removed": 0,
"constraints_added": 0,
"constraints_removed": 0
}
}],
"errors": []
}

But this is never exposed in the GraphDatabase.cypher() callback. The only workaround right now that I know of is to add a RETURN statement which adds an unnecessary penalty hit.

@aseemk
Copy link
Member

aseemk commented Jul 6, 2015

Nice idea! I was only vaguely aware of stats, but haven't experienced it myself. How do you get it?

@aseemk
Copy link
Member

aseemk commented Jul 6, 2015

Btw, FWIW, we at @fiftythree do RETURN in order to get this info, but it doesn't have to be a penalty hit: you can always RETURN COUNT(foo), which is usually the same info as the stat you're interested in.

E.g. unfollow and return whether unfollowed (or wasn't following in the first place):

MATCH (a:User ...) -[r:follows]-> (b:User ...)
DELETE r
RETURN COUNT(r)

That returns 1 if a relationship was found and deleted, 0 if not.

@aseemk aseemk changed the title MATCH and SET without RETURN returns ambiguous result Cypher stats Jul 6, 2015
@aseemk aseemk added this to the v2 redesign milestone Oct 12, 2015
@sagdelen
Copy link

sagdelen commented Apr 1, 2016

It would be very nice to have this kind of stats optionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants