Azure / Azure/data-api-builder

[Bug]: Creating a relationship to the same table twice causes null data.

オープン
#1,718 コメント 5 件 リアクション 0 件 担当者 1 名 @seantleonard が担当を希望しています GitHub で見る
bug cri triage
主要言語
C#
スター
1.5k
フォーク
370
平均マージ
3日 22時間
マージ済み PR(30日)
9

説明

### What happened?

Love this project!
Though I am encountering an issue.

I have an Orders table which has a two columns CountryTypeId and ShippingCountryTypeId.
I have a CountryTypes table which lists countries.

My C# Order model has a CountryType member and a ShippingCountryType member.

```
CountryType () {
int CountryTypeId
string CountryTypeName
string CountryTypeCode
}
```

The goal is to fill these two members from a graphQl request. I do not have a join table in the database.
I want to pull data from CountryTypes table twice (2 joins), essentially, once for each the matching CountryTypeId and another for the ShippingCountryTypeId.

My dab.config looks like this:

```
"Order": {
"source": {
..... for brevity
},
"graphql": {
"enabled": true,
..... for brevity
}
},

"CountryType": {
"cardinality": "one",
"target.entity": "CountryType",
"source.fields": [
"CountryTypeId"
],
"target.fields": [
"CountryTypeId"
],
"linking.source.fields": ["CountryTypeId"],
"linking.target.fields": ["CountryTypeId"]
},
"ShippingCountryType": {
"cardinality": "one",
"target.entity": "CountryType",
"source.fields": [
"ShippingCountryTypeId"
],
"target.fields": [
"CountryTypeId"
],
"linking.source.fields": ["ShippingCountryTypeId"],
"linking.target.fields": ["CountryTypeId"]
}
}
```

Graphql retuned:

```
"CountryType": null,
"ShippingCountryType": null
```

If I do:

```
"CountryType": {
"cardinality": "one",
"target.entity": "CountryType",
"source.fields": [
"CountryTypeId"
],
"target.fields": [
"CountryTypeId"
]
}
}
```

It returns the proper data.

### Version

0.8.50+69f45352c90fae016c33c4e6c1294105898269cc

### What database are you using?

Azure SQL

### What hosting model are you using?

Local (including CLI)

### Which API approach are you accessing DAB through?

GraphQL

### Relevant log output

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。