postgrest-docs icon indicating copy to clipboard operation
postgrest-docs copied to clipboard

[Request] Add compelling example of impressive functionality(Resource Embedding)

Open elimisteve opened this issue 8 years ago • 3 comments

At https://postgrest.com/en/v0.4/api.html it says:

PostgREST can also detect relations going through join tables. Thus you can request the Actors for Films (which in this case finds the information through Roles).

That is awesome, and just what I need for something I'm building right now. Please show what the query/request looks like to do this! I can imagine a case where there are multiple tables that are join tables, and I'm not sure how PostgREST distinguishes between them.

elimisteve avatar May 27 '17 08:05 elimisteve

If you've read through https://postgrest.com/en/v0.4/api.html#resource-embedding then here's one such query:

/films?select=*,actors{*}

Postgrest will find the connection through the Roles table. Is this the kind of thing you're wondering about? In the case of distinguishing which jions to do, can you post an example schema? We can try it out and make some documentation from it.

begriffs avatar May 27 '17 15:05 begriffs

Been a long time, but I guess this calls for a tutorial about the Resource Embedding capabilities.

steve-chavez avatar Aug 15 '19 17:08 steve-chavez

@steve-chavez Sounds like a good idea to me!

elimisteve avatar Aug 15 '19 18:08 elimisteve

Resource embedding is much better documented by now!

wolfgangwalther avatar Feb 18 '24 14:02 wolfgangwalther