Skip to content

Instantly share code, notes, and snippets.

@ameyms
Last active April 24, 2023 18:50
Show Gist options
  • Save ameyms/6e495867afe50d8a82d8da97eb85180d to your computer and use it in GitHub Desktop.
Save ameyms/6e495867afe50d8a82d8da97eb85180d to your computer and use it in GitHub Desktop.
GQL Examples

car_owners_summary is a query that should return a summarization of car owner information (with time granularity as an optional argument)

The part I was curious about was how you feel about "row count increasing by adding one additional field in the query". Essentially, when fields are added to the query, it returns a cross product between two tables.

Example 1

Query

{
  car_owners_summary {
    gender
  }
}

Response

{
  car_owners_summary: [{
    gender: "male"
  },{
    gender: "female"
  }]
}

Example 2

Query

{
  car_owners_summary {
    gender
    state
  }
}

Response

{
  car_owners_summary: [{
    gender: "male",
    state: "TX"
  },{
    gender: "male",
    state: "CA"
  },{
    gender: "female",
    state: "MI"
  },{
    gender: "female",
    state: "CA"
  },{
    gender: "female",
    state: "TX"
  },{
    gender: "female",
    state: "WA"
  },{
    gender: "female",
    state: "NV"
  }]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment