Light
Dark
System
v2latest
v3dev
v2latest
v1

Paths

A path expression (or simply a path) represents a set of values that are reachable by traversing a given sequence of links or properties from some source set of objects.

Consider the following schema:

Copy
type User {
  required property email -> str;
  multi link friends -> User;
}

type BlogPost {
  required property title -> str;
  required link author -> User;
}

The simplest path is simply User. This is a set reference that refers to all User objects in the database.

Copy
select User;

Paths can traverse links. The path below refers to all Users who are the friend of another User.

Copy
select User.friends;

Paths can traverse arbitrarily many links.

Copy
select BlogPost.author.friends.friends;

Paths can terminate with a property reference.

Copy
select BlogPost.title; # all blog post titles
select BlogPost.author.email; # all author emails
select User.friends.email; # all friends' emails

For simplicity, all examples above use set references like User as the root of the path; however, the root can be any expression returning object types. Below, the root of the path is a subquery.

Copy
db> 
... 
... 
... 
with edgedb_lovers := (
  select BlogPost filter .title ilike "EdgeDB is awesome"
)
select edgedb_lovers.author;

This expression returns a set of all Users who have written a blog post titled “EdgeDB is awesome”.

For a full syntax definition, see the Reference > Paths.

Light
Dark
System