Skip to content

Instantly share code, notes, and snippets.

@hjst
Last active May 11, 2017 10:02
Show Gist options
  • Save hjst/2869815ec97257132b66b8156b33fef0 to your computer and use it in GitHub Desktop.
Save hjst/2869815ec97257132b66b8156b33fef0 to your computer and use it in GitHub Desktop.
Sample cross-table query with postgraphql 3.2.0
{
allFilms(first: 5) {
edges {
cursor
node {
nodeId
filmId
title
releaseYear
actors: filmActorsByFilmId {
edges {
node {
actorByActorId {
firstName
lastName
}
}
}
}
}
}
}
}
< 2017-05-11 11:00:45.846 BST > LOG: statement: begin
< 2017-05-11 11:00:45.858 BST > LOG: execute <unnamed>: select to_json(__local_0__) as value from "public"."film" as __local_0__ where "film_id" is not null and true and true and true order by "film_id" using < limit $1
< 2017-05-11 11:00:45.858 BST > DETAIL: parameters: $1 = '5'
< 2017-05-11 11:00:45.865 BST > LOG: execute <unnamed>: select to_json(__local_0__) as value from "public"."film_actor" as __local_0__ where "actor_id" is not null and "film_id" is not null and true and true and ("film_id" = $1) order by "actor_id" using <, "film_id" using < limit all
< 2017-05-11 11:00:45.865 BST > DETAIL: parameters: $1 = '1'
< 2017-05-11 11:00:45.870 BST > LOG: execute <unnamed>: select to_json(__local_0__) as value from "public"."film_actor" as __local_0__ where "actor_id" is not null and "film_id" is not null and true and true and ("film_id" = $1) order by "actor_id" using <, "film_id" using < limit all
< 2017-05-11 11:00:45.870 BST > DETAIL: parameters: $1 = '2'
< 2017-05-11 11:00:45.876 BST > LOG: execute <unnamed>: select to_json(__local_0__) as value from "public"."film_actor" as __local_0__ where "actor_id" is not null and "film_id" is not null and true and true and ("film_id" = $1) order by "actor_id" using <, "film_id" using < limit all
< 2017-05-11 11:00:45.876 BST > DETAIL: parameters: $1 = '3'
< 2017-05-11 11:00:45.878 BST > LOG: execute <unnamed>: select to_json(__local_0__) as value from "public"."film_actor" as __local_0__ where "actor_id" is not null and "film_id" is not null and true and true and ("film_id" = $1) order by "actor_id" using <, "film_id" using < limit all
< 2017-05-11 11:00:45.878 BST > DETAIL: parameters: $1 = '4'
< 2017-05-11 11:00:45.886 BST > LOG: execute <unnamed>: select to_json(__local_0__) as value from "public"."film_actor" as __local_0__ where "actor_id" is not null and "film_id" is not null and true and true and ("film_id" = $1) order by "actor_id" using <, "film_id" using < limit all
< 2017-05-11 11:00:45.886 BST > DETAIL: parameters: $1 = '5'
< 2017-05-11 11:00:45.889 BST > LOG: execute <unnamed>: select row_to_json(__local_0__) as object from "public"."actor" as __local_0__ where "actor_id" = any($1) limit $2
< 2017-05-11 11:00:45.889 BST > DETAIL: parameters: $1 = '{1,10,20,30,40,53,108,162,188,198}', $2 = '10'
< 2017-05-11 11:00:45.890 BST > LOG: execute <unnamed>: select row_to_json(__local_0__) as object from "public"."actor" as __local_0__ where "actor_id" = any($1) limit $2
< 2017-05-11 11:00:45.890 BST > DETAIL: parameters: $1 = '{19,85,90,160}', $2 = '4'
< 2017-05-11 11:00:45.894 BST > LOG: execute <unnamed>: select row_to_json(__local_0__) as object from "public"."actor" as __local_0__ where "actor_id" = any($1) limit $2
< 2017-05-11 11:00:45.894 BST > DETAIL: parameters: $1 = '{2,19,24,64,123}', $2 = '5'
< 2017-05-11 11:00:45.895 BST > LOG: execute <unnamed>: select row_to_json(__local_0__) as object from "public"."actor" as __local_0__ where "actor_id" = any($1) limit $2
< 2017-05-11 11:00:45.895 BST > DETAIL: parameters: $1 = '{41,81,88,147,162}', $2 = '5'
< 2017-05-11 11:00:45.897 BST > LOG: execute <unnamed>: select row_to_json(__local_0__) as object from "public"."actor" as __local_0__ where "actor_id" = any($1) limit $2
< 2017-05-11 11:00:45.897 BST > DETAIL: parameters: $1 = '{51,59,103,181,200}', $2 = '5'
< 2017-05-11 11:00:45.899 BST > LOG: statement: commit
{
"data": {
"allFilms": {
"edges": [
{
"cursor": "WyJwcmltYXJ5X2tleV9hc2MiLFsxXV0=",
"node": {
"nodeId": "WyJmaWxtcyIsMV0=",
"filmId": 1,
"title": "ACADEMY DINOSAUR",
"releaseYear": 2006,
"actors": {
"edges": [
{
"node": {
"actorByActorId": {
"firstName": "PENELOPE",
"lastName": "GUINESS"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "CHRISTIAN",
"lastName": "GABLE"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "LUCILLE",
"lastName": "TRACY"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "SANDRA",
"lastName": "PECK"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "JOHNNY",
"lastName": "CAGE"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "MENA",
"lastName": "TEMPLE"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "WARREN",
"lastName": "NOLTE"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "OPRAH",
"lastName": "KILMER"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "ROCK",
"lastName": "DUKAKIS"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "MARY",
"lastName": "KEITEL"
}
}
}
]
}
}
},
{
"cursor": "WyJwcmltYXJ5X2tleV9hc2MiLFsyXV0=",
"node": {
"nodeId": "WyJmaWxtcyIsMl0=",
"filmId": 2,
"title": "ACE GOLDFINGER",
"releaseYear": 2006,
"actors": {
"edges": [
{
"node": {
"actorByActorId": {
"firstName": "BOB",
"lastName": "FAWCETT"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "MINNIE",
"lastName": "ZELLWEGER"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "SEAN",
"lastName": "GUINESS"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "CHRIS",
"lastName": "DEPP"
}
}
}
]
}
}
},
{
"cursor": "WyJwcmltYXJ5X2tleV9hc2MiLFszXV0=",
"node": {
"nodeId": "WyJmaWxtcyIsM10=",
"filmId": 3,
"title": "ADAPTATION HOLES",
"releaseYear": 2006,
"actors": {
"edges": [
{
"node": {
"actorByActorId": {
"firstName": "NICK",
"lastName": "WAHLBERG"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "BOB",
"lastName": "FAWCETT"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "CAMERON",
"lastName": "STREEP"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "RAY",
"lastName": "JOHANSSON"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "JULIANNE",
"lastName": "DENCH"
}
}
}
]
}
}
},
{
"cursor": "WyJwcmltYXJ5X2tleV9hc2MiLFs0XV0=",
"node": {
"nodeId": "WyJmaWxtcyIsNF0=",
"filmId": 4,
"title": "AFFAIR PREJUDICE",
"releaseYear": 2006,
"actors": {
"edges": [
{
"node": {
"actorByActorId": {
"firstName": "JODIE",
"lastName": "DEGENERES"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "SCARLETT",
"lastName": "DAMON"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "KENNETH",
"lastName": "PESCI"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "FAY",
"lastName": "WINSLET"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "OPRAH",
"lastName": "KILMER"
}
}
}
]
}
}
},
{
"cursor": "WyJwcmltYXJ5X2tleV9hc2MiLFs1XV0=",
"node": {
"nodeId": "WyJmaWxtcyIsNV0=",
"filmId": 5,
"title": "AFRICAN EGG",
"releaseYear": 2006,
"actors": {
"edges": [
{
"node": {
"actorByActorId": {
"firstName": "GARY",
"lastName": "PHOENIX"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "DUSTIN",
"lastName": "TAUTOU"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "MATTHEW",
"lastName": "LEIGH"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "MATTHEW",
"lastName": "CARREY"
}
}
},
{
"node": {
"actorByActorId": {
"firstName": "THORA",
"lastName": "TEMPLE"
}
}
}
]
}
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment