Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Unable to insert,update,delete from GraphQL

I am using Graph Ql, I performing the different CRUD operation. When I am doing single update,insert and delete its working. But when I am trying with multiple rows I am not able to do. Did any one tried it ?

 

 

  • Hi Anonymous 
    Thank you for being part of the Microsoft Fabric Community.
    If your fabric graphql api allows array-based inserts, you can modify the mutation to accept multiple records:

    ****************************************************************
    mutation CreateEmployees($items: [EmpInput!]!) {
      createempinfo(items: $items) {
        Id
        Name
        Address
      }
    }

    ******************************************************************

    JSON

    ******************************************************************

    {
    "query": "mutation CreateEmployees($items: [EmpInput!]!) { createempinfo(items: $items) { Id Name Address } }",
    "variables": {
    "items": [
    {"Address": "Pune", "Id": 1000, "Name": "Then"},
    {"Address": "Paratwada", "Id": 1001, "Name": "Chetan"}
    ]
    }
    }

    ******************************************************************

     

    If the above information helps you, please give us a Kudos and marked the reply Accept as a Solution.

    Thanks,
    Cheri Srikanth

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      I have used Id as primary key. 

  • v-csrikanth's avatar
    v-csrikanth
    Community Support

    Hi Anonymous 
    Thank you for being part of the Microsoft Fabric Community.
    If your fabric graphql api allows array-based inserts, you can modify the mutation to accept multiple records:

    ****************************************************************
    mutation CreateEmployees($items: [EmpInput!]!) {
      createempinfo(items: $items) {
        Id
        Name
        Address
      }
    }

    ******************************************************************

    JSON

    ******************************************************************

    {
    "query": "mutation CreateEmployees($items: [EmpInput!]!) { createempinfo(items: $items) { Id Name Address } }",
    "variables": {
    "items": [
    {"Address": "Pune", "Id": 1000, "Name": "Then"},
    {"Address": "Paratwada", "Id": 1001, "Name": "Chetan"}
    ]
    }
    }

    ******************************************************************

     

    If the above information helps you, please give us a Kudos and marked the reply Accept as a Solution.

    Thanks,
    Cheri Srikanth

  • v-csrikanth's avatar
    v-csrikanth
    Community Support

    Hi Anonymous 
    We haven't heard from you since last response and just wanted to check whether the solution provided has worked for you. If yes, please accept as solution to help others benefit.
    Thank you.