a-type / graphql-cypher

A simple but powerful translation layer between GraphQL and Cypher
17 stars 2 forks source link

Filtering and paginating on @cypherNode and @cypherRelationship #3

Open a-type opened 5 years ago

a-type commented 5 years ago

Connecting directives need more control over how the data is queried.

Research:

Implement:

Questions:

a-type commented 5 years ago

Research results: only WHERE is allowed in list projections (https://github.com/opencypher/openCypher/issues/202).

Ordering, skipping, limiting will all be blocked on better sub-query support (https://github.com/opencypher/openCypher/pull/217), but if that gets added to the spec, the library will get a major feature boost!

A fake pagination could be introduced by slicing up the list comprehension, but it would not be lazy, and without ordering it doesn't feel very useful. List ordering currently unsupported (https://github.com/opencypher/openCypher/issues/190).

Alternate approach to achieving nested paginated fields: manually combine subqueries by chaining WITH blocks then pull them back into a final map projection (yikes!)... might end up doing it. Query perf might be worse due to eager operations, but I think that's going to be unavoidable if the schema uses pagination at each field level anyways.

a-type commented 5 years ago

Next steps:

SpaghettiFactory commented 4 years ago

This is marked as blocked. What is needed in order to implement this?

a-type commented 4 years ago

Hi @SpaghettiFactory ! I admit this project isn't really on my radar anymore, but here's how I remember it -

Basically, without first-class subqueries, Cypher can't really support nested pagination. I don't quite remember the specifics, but I believe this library uses field projections to accomplish nested structures, and field projections don't allow for standard pagination constructs to be used (or at least, not to the extend that they could enable cursor-based pagination).

This issue was related, and is still open - https://github.com/opencypher/openCypher/pull/217

Limitations with Cypher for this use case in particular was, as I recall, why I ended up shopping around for different graph databases to use behind GraphQL. I had a bit of success with ArangoDB, which does support subqueries in its query language.