Skip to content

Cypher stats #163

Open
Open

Description

@stefanli

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.

Activity

  1. aseemk commented on Jul 6, 2015

    @aseemk
    Member

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

  2. aseemk commented on Jul 6, 2015

    @aseemk
    Member

    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.

  3. changed the title [-]MATCH and SET without RETURN returns ambiguous result[/-] [+]Cypher stats[/+] on Jul 6, 2015
  4. added this to the v2 redesign milestone on Oct 12, 2015
  5. sagdelen commented on Apr 1, 2016

    @sagdelen

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions