EdgeDB 1.0 is launching on Feb 10th! Watch the live event.
Claim your ticket

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:

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.

select User;

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

select User.friends;

Paths can traverse arbitrarily many links.

select BlogPost.author.friends.friends;

Paths can terminate with a property reference.

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.

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.