Azure / Azure/data-api-builder

[Enh]: Support relationships between views (and tables).

オープン
#3,079 コメント 0 件 リアクション 2 件 担当者 2 名 @JerryNixon が担当を希望しています GitHub で見る
2.2 enhancement graphql has-pr mssql pgsql mysql
主要言語
C#
スター
1.5k
フォーク
370
平均マージ
3日 22時間
マージ済み PR(30日)
9

説明

## What

Allow entities backed by **views** to participate in relationships.

### Supported combinations

* view → view
* view → table
* table → view

No new configuration syntax. Existing `entities..relationships` settings continue to work.

### Unlimited combinations

```mermaid
flowchart LR
Table1
Table2
View1
View2

Table1 --> Table2
Table1 --> View1
View1 --> View2
View1 --> Table2
```

> [!NOTE]
> Stored procedures cannot be related.

## Why

Today relationships only work between table entities.

However, DAB already allows relationships to be defined in configuration without requiring database FK constraints. If a relationship can be described using fields in configuration, the engine should be able to generate the join even when the underlying object is a view.

This enables common read models where views shape the data exposed through the API. A view such as `SeriesActors` can already be exposed as an entity, but it cannot currently participate in relationships.

## Example

View → table relationship

> Exactly the same syntax as before

```json
"entities": {
"BooksView": {
"source": { "object": "dbo.vw_books_details", "type": "view" },
"relationships": {
"publisher": {
"cardinality": "one",
"target.entity": "Publisher",
"relationship.fields": [ "publisher_id:id" ]
}
}
}
}
```

### View → view relationship

> Exactly the same syntax as table

```json
"relationships": {
"authors": {
"cardinality": "many",
"target.entity": "AuthorsView",
"relationship.fields": [ "id:book_id" ]
}
}
```

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

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

評価

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

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

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