Skip to content

surrealql: A better way to query graph paths #368

@Sergionx

Description

@Sergionx

Is your feature request related to a problem?

Currently, surrealql rely on Expr to write queries like this: user->owns->book->written_by
The problem comes when wanting to filter some path like ->(wrote WHERE written_at = "Athens")->book.*

To refine a graph path on query becomes cumbersoe when dealing only with strings. If my solutions need a dynamic way to build the where inside a graph path, there is currently no way

Describe the solution

I propose a composable way of writing relations like

Path(Node(user, ->), Edge(owns, ->), Node(book, ->), Edge(written_by) )

And Node and Edge accept an optional third parameter to include a where clause

This is just an example, the implementation probably will be different. The important thing on my opinion is to reference each "checkpoint" (node or edge) so if in the fure an ORM would use surrealql it would be easier for it

Alternative methods

I cant think of alternative methods at the moment

SurrealDB version

2.3.10

Contact Details

sergionx.dev@gmail.com

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions