Single Table Row Data fetching in Hasura

Viewed 108

Is there any way that I could insert data from single table multiple row's by using a single query as follows in Hasura.

Where the data1 and point1 are dynamic.

Input Example:


 
{ 
  "table1" : {
  
  id: "",
  name : "",
  value : "".
  result:
  {
    data1: "",
    point1: "",

    data2: "",
    point2: "",

  }
  
  

}


1 Answers

You can do a mutation with parameters. Try to adapt the below to your needs:

mutation MyMutation($objects: [projects_insert_input!] = {}) {
  insert_table1(objects: $objects) {
    returning {
      id
      name
      value
      result
    }
  }
}

Parameters:

{
  "objects": {
      "id" : "myId",
      "name": "myName",
      "value": "myValue",
        "result":{
        "data":"Data1",
        "point":"Point1"
      }
  }
}

More info: https://hasura.io/learn/graphql/intro-graphql/graphql-mutations/

Related