fix: don't enforce many-to-one/one-to-many relationships for DWSQL - #3770
Open
Ritika Dhawan (ritikadhawan) wants to merge 2 commits into
Open
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Ritika Dhawan (ritikadhawan)
marked this pull request as ready for review
August 12, 2026 13:34
Ritika Dhawan (ritikadhawan)
requested review from
Aniruddh Munde (Aniruddh25),
Jerry Nixon (JerryNixon),
aaronburtle and
Anusha Kolan (anushakolan)
as code owners
August 12, 2026 13:34
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Ritika Dhawan (ritikadhawan)
August 12, 2026 13:35
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts GraphQL schema generation for Fabric Warehouse (DWSQL) so relationship fields are not incorrectly marked non-nullable when foreign keys aren’t enforced, preventing HC0018 failures on orphaned rows.
Changes:
- Threads
DatabaseTypethrough SQL GraphQL schema generation to inform nullability decisions. - Treats DWSQL relationship fields as nullable during schema conversion to avoid non-null GraphQL contract violations.
- Adds/extends unit tests to validate relationship-field nullability behavior for DWSQL vs. SQL Server.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Service.Tests/GraphQLBuilder/Sql/SchemaConverterTests.cs | Adds tests asserting relationship field nullability differs for DWSQL vs MSSQL. |
| src/Service.GraphQLBuilder/Sql/SchemaConverter.cs | Introduces DWSQL-aware relationship nullability handling during schema conversion. |
| src/Core/Services/GraphQLSchemaCreator.cs | Passes the runtime database type into schema conversion so DWSQL behavior is applied. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
|
/azp run |
|
Azure Pipelines: Successfully started running 6 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's the problem?
When Data API builder serves a Fabric Warehouse (DWSQL) database, a GraphQL query that follows a relationship between two tables could fail with this error:
...even when the query was perfectly valid and the data was fine. Instead of returning the row, the whole query blew up.
Why does it happen?
Most databases guarantee that if a row points to a "parent" row (a foreign key), that parent actually exists. DAB relies on that guarantee: if a foreign-key column is marked "required" (NOT NULL), DAB assumes the related object is always there, and tells GraphQL "this related field will never be null."
Fabric Warehouse is different — it does not enforce foreign keys. So a child row can happily point at a parent that doesn't exist (an "orphaned" row). When GraphQL asks for that missing parent, DAB has nothing to return, but it already promised the field would never be null. GraphQL sees a broken promise and throws HC0018.
Example: an
Enrollmentrow has astudentIdthat noStudentmatches. Asking forenrollment.studentreturns nothing, and the query fails.What does this change do?
For Fabric Warehouse (DWSQL) only, DAB no longer assumes related rows always exist. It marks the related fields on many-to-one and one-to-many relationships as nullable. That way, when a related row is genuinely missing, the query simply returns
nullfor that field instead of failing the entire request.Behavior for all other databases (SQL Server, PostgreSQL, MySQL) is unchanged, since they do enforce foreign keys.
How was it verified?
student: null.Before
After