Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple mutations not supported in PGSQL #2485

Open
1 task done
osamamaruf opened this issue Dec 2, 2024 · 1 comment
Open
1 task done

Multiple mutations not supported in PGSQL #2485

osamamaruf opened this issue Dec 2, 2024 · 1 comment
Labels
enhancement New feature or request Multiple mutations Fixes/enhancements related to nested mutations. triage issues to be triaged

Comments

@osamamaruf
Copy link

osamamaruf commented Dec 2, 2024

What happened?

Current behavior
I am using the following tutorial and while using the following query

mutation {
  createBook(
    item: {
      id: 1
      title: "Introduction to Data API builder"
      pages: 200
      years: 2024
      chapters: [
        {
            id: 2
            name: "Configuration files", pages: 150 
        }
        {
            id: 3
            name: "Running", pages: 50
        }
      ]
    }
  ) {
    id
    title
    pages
    years
    chapters {
      items {
        name
        pages
      }
    }
  }
}

I get the following error;

{
  "errors": [
    {
      "message": "The specified input object field `chapters` does not exist.",
      "locations": [
        {
          "line": 8,
          "column": 7
        }
      ],
      "path": [
        "createBook"
      ],
      "extensions": {
        "field": "chapters",
        "specifiedBy": "http://spec.graphql.org/October2021/#sec-Input-Object-Field-Names"
      }
    }
  ]
}

dab-config.json

{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/v1.3.19/dab.draft.schema.json",
  "data-source": {
    "database-type": "postgresql",
    "connection-string": "Host=localhost;Port=5431;Database=postgres;User ID=postgres;Password=password;",
    "options": {}
  },
  "runtime": {
    "rest": {
      "enabled": true,
      "path": "/api",
      "request-body-strict": true
    },
    "graphql": {
      "enabled": true,
      "path": "/graphql",
      "allow-introspection": true
    },
    "host": {
      "cors": {
        "origins": [],
        "allow-credentials": false
      },
      "authentication": {
        "provider": "StaticWebApps"
      },
      "mode": "development"
    }
  },
  "entities": {
    "Book": {
      "source": {
        "object": "books",
        "type": "table"
      },
      "graphql": {
        "enabled": true,
        "type": {
          "singular": "Book",
          "plural": "Books"
        }
      },
      "rest": {
        "enabled": true
      },
      "permissions": [
        {
          "role": "anonymous",
          "actions": [
            {
              "action": "*"
            }
          ]
        }
      ],
      "relationships": {
        "chapters": {
          "cardinality": "many",
          "target.entity": "Chapter",
          "source.fields": [],
          "target.fields": [],
          "linking.source.fields": [],
          "linking.target.fields": []
        }
      }
    },
    "Chapter": {
      "source": {
        "object": "chapters",
        "type": "table"
      },
      "graphql": {
        "enabled": true,
        "type": {
          "singular": "Chapter",
          "plural": "Chapters"
        }
      },
      "rest": {
        "enabled": true
      },
      "permissions": [
        {
          "role": "anonymous",
          "actions": [
            {
              "action": "*"
            }
          ]
        }
      ],
      "relationships": {
        "book": {
          "cardinality": "one",
          "target.entity": "Book",
          "source.fields": [],
          "target.fields": [],
          "linking.source.fields": [],
          "linking.target.fields": []
        }
      }
    }
  }
}

Expected Behavior
Book and its Chapters should get created.

Version

1.3.19

What database are you using?

PostgreSQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

GraphQL

Relevant log output

{
  "errors": [
    {
      "message": "The specified input object field `chapters` does not exist.",
      "locations": [
        {
          "line": 8,
          "column": 7
        }
      ],
      "path": [
        "createBook"
      ],
      "extensions": {
        "field": "chapters",
        "specifiedBy": "http://spec.graphql.org/October2021/#sec-Input-Object-Field-Names"
      }
    }
  ]
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@osamamaruf osamamaruf added bug Something isn't working triage issues to be triaged labels Dec 2, 2024
@abhishekkumams
Copy link
Contributor

@osamamaruf , currently multiple mutation is only supported in MSSQL.

@abhishekkumams abhishekkumams added enhancement New feature or request Multiple mutations Fixes/enhancements related to nested mutations. and removed bug Something isn't working labels Dec 3, 2024
@abhishekkumams abhishekkumams changed the title [Bug]: Multiple mutation does not work Multiple mutations not supported in PGSQL Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Multiple mutations Fixes/enhancements related to nested mutations. triage issues to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants