Forum Discussion
GraphQL update... mutation for Fabric SQL DB failing
Hi everybody,
I want to update items in a Fabric SQL DB via GraphQL mutation query. But that fails with "InternalServerError" (and nothing else).
What I tried:
- ❌ mutation update....
- ✅ mutation create...
- ✅ mutation delete...
✅ (directly in the SQL DB): UPDATE dbo.product SET product_name = 'CHANGED' WHERE ROWID = '<UUID>'
Did someone else here experience something similar? Is this a defect 🐞 in the GraphQL API / Fabric SQL DB / their combination?
What was your solution? (And what was the issue exactly?)
A workaround might be to create a stored proc and let that do the update. I'd prefer to be able to use a working update mutation though. So
Any help highly appreciated! <3 --> Snippets below
Best
Martin
(Snippets stripped down for readability)
The failing mutation:
mutation {
updateproduct (
ROWID: "<UUID>",
item: {
product_name: "CHANGED"
})
{
ROWID product_name
}
}
//// Definitions from the GraphQL schema:
"""Updates a product"""
updateproduct (
"""The ID of the item being updated."""
ROWID: UUID!
"""Input representing all the fields for updating product"""
item: UpdateproductInput!
): product
"""Input type for updating product_mapping"""
input UpdateproductInput {
"""Input for field ROWID on type UpdateproductInput"""
ROWID: UUID
"""Input for field product_name on type UpdateproductInput"""
product_name: String
}The table in Fabric SQL DB (as by "Script as create")
CREATE TABLE [dbo].[product](
[ROWID] [uniqueidentifier] NOT NULL,
[product_name] [nvarchar](255) NOT NULL,
) ON [PRIMARY]
ALTER TABLE [dbo].[product_mapping]
ADD PRIMARY KEY CLUSTERED (
[ROWID] ASC
) WITH ( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ONLINE = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF)
ON [PRIMARY]
ALTER TABLE [dbo].[product_mapping]
ADD DEFAULT (newsequentialid()) FOR [ROWID]
1 Reply
- ipkusFrequent Visitor
Yes, GraphQL can be slightly sensitive when it comes to mutations. We have been able to implement several mutations via strored procdures.
Looks like your mutation has gotten classified as a write-only (Mutation). This means it doesn't produce a Query node. GraphQL schema generation requires at least one Query field by spec — without it, schema validation fails. In the absence of a Query field, schema validation cannot be completed successfully.
Also, make sure Referenced tables are present and accessible in the underlying data source. If the required tables are unavailable, the stored procedure may fail and return a SQL error.