データベース エンティティの構成設定。
Health
| Property | Description |
|---|---|
entities.entity-name.health.enabled |
エンティティの正常性チェックを有効にします (REST エンドポイントと GraphQL エンドポイントの両方) |
entities.entity-name.health.first |
正常性チェック クエリで返される行の数 (範囲: 1 から 500) |
entities.entity-name.health.threshold-ms |
正常性チェック クエリの最大期間 (ミリ秒単位) (最小: 1) |
Description
| Property | Description |
|---|---|
entities.entity-name.description |
エンティティの人間が判読できる説明 |
Fields
| Property | Description |
|---|---|
entities.entity-name.fields[].name |
データベース フィールド名 (必須) |
entities.entity-name.fields[].alias |
API で公開される名前 (マッピングを置き換えます) |
entities.entity-name.fields[].description |
人間が判読できるフィールドの説明 |
entities.entity-name.fields[].primary-key |
フィールドを主キーとしてマークします (キー フィールドを置き換えます) |
Source
| Property | Description |
|---|---|
entities.entity-name.source.type |
オブジェクトの種類: table、 view、または stored-procedure |
entities.entity-name.source.object |
データベース オブジェクトの名前 |
entities.entity-name.source.object-description |
データベース オブジェクトの人間が判読できる説明 |
entities.entity-name.source.parameters |
ストアド プロシージャまたは関数のパラメーター |
entities.entity-name.source.key-fields |
|
entities.entity-name.mappings |
|
REST
| Property | Description |
|---|---|
entities.entity-name.rest.enabled |
このエンティティの REST を有効にします |
entities.entity-name.rest.path |
REST エンドポイントのカスタム ルート |
entities.entity-name.rest.methods |
使用できる REST メソッド: get、 post、 put、 patch、 delete |
GraphQL
| Property | Description |
|---|---|
entities.entity-name.graphql.type |
singularを使用して名前またはオブジェクトを入力します。plural |
entities.entity-name.graphql.operation |
操作の種類: query または mutation |
entities.entity-name.graphql.enabled |
このエンティティの GraphQL を有効にします |
Permissions
| Property | Description |
|---|---|
entities.entity-name.permissions[].role |
ロール名の文字列 |
entities.entity-name.permissions[].actions |
1 つ以上: create、 read、 update、 delete、 execute |
Relationships
| Property | Description |
|---|---|
entities.entity-name.relationships.relationship-name.cardinality |
one または many |
entities.entity-name.relationships.relationship-name.target.entity |
ターゲット エンティティの名前 |
entities.entity-name.relationships.relationship-name.source.fields |
リレーションシップで使用されるこのエンティティのフィールド |
entities.entity-name.relationships.relationship-name.target.fields |
ターゲット エンティティのフィールド |
entities.entity-name.relationships.relationship-name.linking.object |
多対多リレーションシップに使用される結合オブジェクト |
entities.entity-name.relationships.relationship-name.linking.source.fields |
結合で使用されるソース エンティティのフィールド |
entities.entity-name.relationships.relationship-name.linking.target.fields |
結合で使用されるターゲット エンティティのフィールド |
Cache
| Property | Description |
|---|---|
entities.entity-name.cache.enabled |
エンティティの応答キャッシュを有効にします |
entities.entity-name.cache.ttl-seconds |
キャッシュの有効期間 (秒単位) |
entities.entity-name.cache.level |
キャッシュ レベル: L1 (メモリ内のみ) または L1L2 (インメモリ + 分散) |
MCP
| Property | Description |
|---|---|
entities.entity-name.mcp |
エンティティのモデル コンテキスト プロトコル (MCP) 参加を制御するオブジェクト |
entities.entity-name.mcp.dml-tools |
エンティティのデータ操作言語 (DML) ツールを有効または無効にします |
entities.entity-name.mcp.custom-tool |
ストアド プロシージャを名前付き MCP ツールとして登録します (ストアド プロシージャ エンティティのみ) |
書式の概要
{
"entities": {
"{entity-name}": {
"description": <string>,
"rest": {
"enabled": <boolean> // default: true
"path": <string> // default: "{entity-name}"
"methods": ["GET", "POST"] // default: ["GET", "POST"]
},
"graphql": {
"enabled": <boolean> // default: true
"type": {
"singular": <string>,
"plural": <string>
},
"operation": "query" | "mutation" // default: "query"
},
"source": {
"object": <string>,
"object-description": <string>,
"type": "view" | "stored-procedure" | "table",
"key-fields": [<string>], // DEPRECATED: use fields[].primary-key
"parameters": [ // array format (preferred)
{
"name": "<parameter-name>",
"required": <boolean>,
"default": <value>,
"description": "<string>"
}
]
},
"fields": [
{
"name": "<database-field-name>",
"alias": "<api-exposed-name>",
"description": "<string>",
"primary-key": <boolean>
}
],
"mappings": { // DEPRECATED: use fields[].alias
"<database-field-name>": <string>
},
"relationships": {
"<relationship-name>": {
"cardinality": "one" | "many",
"target.entity": <string>,
"source.fields": [<string>],
"target.fields": [<string>],
"linking.object": <string>,
"linking.source.fields": [<string>],
"linking.target.fields": [<string>]
}
},
"permissions": [
{
"role": "anonymous" | "authenticated" | <custom-role>,
"actions": ["create", "read", "update", "delete", "execute", "*"],
"fields": {
"include": [<string>],
"exclude": [<string>]
},
"policy": {
"database": <string>
}
}
],
"cache": {
"enabled": <boolean>,
"ttl-seconds": <integer>,
"level": "L1" | "L1L2" // default: "L1L2"
},
"mcp": {
"dml-tools": <boolean>, // default: true
"custom-tool": <boolean> // stored-procedure only; default: false
}
}
}
}
ソース (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name} |
source |
オブジェクト | ✔️ はい | None |
エンティティのデータベース ソースの詳細。
入れ子になったプロパティ
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.source |
object |
文字列 | ✔️ はい | None |
entities.{entity-name}.source |
object-description |
文字列 | ❌ いいえ | None |
entities.{entity-name}.source |
type |
enum (table、 view、 stored-procedure) |
✔️ はい | None |
entities.{entity-name}.source |
key-fields |
文字列配列 | ❌ いいえ* | None |
entities.{entity-name}.source |
parameters |
配列またはオブジェクト | ❌ いいえ** | None |
*
key-fields は、 type が view され、 fields 配列が使用されていない場合にのみ必要です。 値は主キーを表します。
Warnung
key-fields プロパティは DAB 2.0 では非推奨です。 代わりに、fieldsでprimary-key: true配列を使用してください。 スキーマは、 fields と key-fields が同じエンティティ上で共存できないことを強制します。
**
parameters は、 type が stored-procedure されている場合にのみ必要であり、既定値を持つパラメーターに対してのみ必要です。 パラメーターのデータ型が推論されます。 既定値のないパラメーターは省略できます。
object-description は、基になるデータベース オブジェクトの人間が判読できる省略可能な説明です。 この値は、MCP ツールの検出中に表示され、AI エージェントがエンティティの目的を理解するのに役立ちます。
Tip
オブジェクトが dbo スキーマに属している場合、スキーマの指定は省略可能です。 さらに、必要に応じて、オブジェクト名の角かっこ ( dbo.Users と [dbo].[Users]など) を使用できます。
Format
{
"entities": {
"{entity-name}": {
"source": {
"object": <string>,
"object-description": <string>,
"type": <"view" | "stored-procedure" | "table">,
"key-fields": [ <string> ], // DEPRECATED: use fields[].primary-key
"parameters": [ // array format (preferred)
{
"name": "<parameter-name>",
"required": <boolean>,
"default": <value>,
"description": "<string>"
}
]
}
}
}
}
パラメーター配列の形式
DAB 2.0 プレビューでは、 parameters はより豊富なメタデータを含む構造化された配列形式をサポートしています。 各パラメーターは、次のプロパティを持つオブジェクトです。
| Property | タイプ | Required | Description |
|---|---|---|---|
name |
文字列 | ✔️ はい | パラメーター名 ( @ プレフィックスなし) |
required |
boolean | ❌ いいえ | パラメーターが必須 (true) か省略可能 (false) か |
default |
any | ❌ いいえ | パラメーターが指定されていない場合に使用される既定値 |
description |
文字列 | ❌ いいえ | 人間が判読できるパラメーターの説明 |
例 (配列形式 - 推奨)
{
"entities": {
"GetBookById": {
"source": {
"type": "stored-procedure",
"object": "dbo.get_book_by_id",
"parameters": [
{
"name": "id",
"required": true,
"default": null,
"description": "The unique identifier of the book"
}
]
}
}
}
}
Warnung
DAB 2.0 では、 parameters のディクショナリ形式 ( { "id": 0 } など) は非推奨です。 上記の配列形式を使用します。 旧形式は下位互換性のために引き続き受け入れられますが、今後のリリースでは削除される予定です。
Note
このセクションで説明する Data API Builder 2.0 の機能は現在プレビュー段階であり、一般公開前に変更される可能性があります。 詳細については、「 バージョン 2.0 の新機能」を参照してください。
アクセス許可 (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.permissions |
role |
文字列 | ✔️ はい | None |
アクセス許可を適用するロール名を指定します。 ID プロバイダーで定義されているシステム ロール (Anonymous、 Authenticated) またはカスタム ロールを使用します。
Tip
ロールの評価、システム ロール、および X-MS-API-ROLE ヘッダーの詳細については、「 承認の概要」を参照してください。
Format
{
"entities": {
"{entity-name}": {
"permissions": [
{
"role": <"Anonymous" | "Authenticated" | "custom-role">,
"actions": [ <string> ]
}
]
}
}
}
Example
{
"entities": {
"User": {
"permissions": [
{
"role": "reader",
"actions": ["read"]
}
]
}
}
}
ロールの継承
DAB 2.0 では、エンティティのアクセス許可にロールの継承が導入されています。 エンティティに対してロールが明示的に構成されていない場合は、次のチェーンを使用して、より広範なロールからアクセス許可を継承します。
named-role → authenticated → anonymous
- エンティティ
authenticated構成されていない場合は、anonymousから継承されます。 - 名前付きロールが構成されていない場合は、
authenticatedから継承されるか、anonymousも存在しない場合はauthenticatedから継承されます。
つまり、 anonymous でアクセス許可を 1 回定義すると、すべての広範なロールが同じアクセス権を自動的に取得し、重複は必要ありません。
Note
このセクションで説明する Data API Builder 2.0 の機能は現在プレビュー段階であり、一般公開前に変更される可能性があります。 詳細については、「 バージョン 2.0 の新機能」を参照してください。
Example
{
"entities": {
"Book": {
"source": "dbo.books",
"permissions": [
{ "role": "anonymous", "actions": [ "read" ] }
]
}
}
}
この構成では、 anonymous、 authenticated、および構成されていない名前付きロールはすべて、 Bookを読み取ることができます。 継承が適用された後、 dab configure --show-effective-permissions を使用して、すべてのエンティティの解決済みアクセス許可を確認します。
アクション (string-array Permissions エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.permissions |
actions |
oneOf [string, array] | ✔️ はい | None |
関連付けられているロールに対して許可される操作の詳細を示す文字列配列。
| Action | SQL 操作 |
|---|---|
* |
すべてのアクション |
create |
1 つ以上の * 行を挿入する |
read |
1 つ以上の行を選択する |
update |
1 つ以上の * 行を変更する |
delete |
1 つ以上の * 行を削除する |
execute |
ストアド プロシージャを実行する |
* 現在、複数の操作は GraphQL でのみサポートされています。
Note
ストアド プロシージャの場合、ワイルドカード (*) アクションは execute アクションにのみ展開されます。 テーブルとビューの場合、create、read、update、および deleteに展開されます。
Format
{
"entities": {
"{entity-name}": {
"permissions": [
{
"actions": [ <string> ]
}
]
}
}
}
Example
{
"entities": {
"{entity-name}": {
"permissions": [
{
"actions": [ "*" ] // equivalent to create, read, update, delete
}
]
}
}
}
代替形式 ( type=stored-procedureの場合は文字列のみ)
{
"entities": {
"{entity-name}": {
"permissions": [
{
"actions": <string>
}
]
}
}
}
Example
{
"entities": {
"{entity-name}": {
"permissions": [
{
"actions": "*" // equivalent to execute
}
]
}
}
}
アクション (object-array Permissions エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.permissions |
actions |
文字列配列 | ✔️ はい | None |
関連付けられたロールに対して許可される操作の詳細を示すオブジェクト配列。
Note
ストアド プロシージャの場合、ワイルドカード (*) アクションは executeにのみ拡張されます。 テーブル/ビューの場合は、create、read、update、および deleteに展開されます。
入れ子になったプロパティ
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.permissions.actions[] |
action |
文字列 | ✔️ はい | None |
entities.{entity-name}.permissions.actions[] |
fields |
オブジェクト | ❌ いいえ | None |
entities.{entity-name}.permissions.actions[] |
policy |
オブジェクト | ❌ いいえ | None |
entities.{entity-name}.permissions.actions[].policy |
database |
文字列 | ✔️ はい | None |
Format
{
"entities": {
"{entity-name}": {
"permissions": [
{
"role": <string>,
"actions": [
{
"action": <string>,
"fields": <array of strings>,
"policy": <object>
}
]
}
]
}
}
Example
これによりreadフィールドとポリシーの制限を使用して、auditor エンティティにUserするアクセス許可が付与されます。
{
"entities": {
"User": {
"permissions": [
{
"role": "auditor",
"actions": [
{
"action": "read",
"fields": {
"include": ["*"],
"exclude": ["last_login"]
},
"policy": {
"database": "@item.IsAdmin eq false"
}
}
]
}
]
}
}
}
ポリシーに関する注意事項
データベース ポリシーは、OData スタイルの述語を使用してクエリ結果をフィルター処理します。
@item.<field>を使用してエンティティ フィールドを参照し、@claims.<type>認証されたユーザー要求を挿入します。
| 特徴 | 詳細 |
|---|---|
| 構文 | OData 述語 (eq、 ne、 and、 or、 gt、 lt) |
| フィールド参照 |
@item.<field> (該当する場合はマップされた名前を使用します) |
| 要求の参照 | @claims.<claimType> |
| サポートされているアクション |
read、 update、 delete |
| サポートされていません |
create、execute |
Tip
要求の置換やトラブルシューティングなど、データベース ポリシーに関する包括的なガイダンスについては、「 データベース ポリシーの構成」を参照してください。
型 (GraphQL エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.graphql |
type |
オブジェクト | ❌ いいえ | {entity-name} |
GraphQL スキーマ内のエンティティの名前付け規則を設定します。
Format
{
"entities": {
"{entity-name}": {
"graphql": {
"type": {
"singular": "<string>",
"plural": "<string>"
}
}
}
}
}
入れ子になったプロパティ
| Parent | Property | Required | タイプ | Default |
|---|---|---|---|---|
entities.{entity-name}.graphql.type |
singular |
✔️ はい* | 文字列 | None |
entities.{entity-name}.graphql.type |
plural |
❌ いいえ | 文字列 | N/A (既定値は単数形) |
*
singular は、 type がオブジェクトとして指定されている場合に必要です。
typeがプレーン文字列の場合、その文字列は単数形の名前として使用されます。
Example
Configuration
{
"entities": {
"User": {
"graphql": {
"type": {
"singular": "User",
"plural": "Users"
}
}
}
}
}
GraphQL クエリ
{
Users {
items {
id
name
age
isAdmin
}
}
}
GraphQL 応答
{
"data": {
"Users": {
"items": [
{
"id": 1,
"name": "Alice",
"age": 30,
"isAdmin": true
},
{
"id": 2,
"name": "Bob",
"age": 25,
"isAdmin": false
}
// ...
]
}
}
}
操作 (GraphQL エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.graphql |
operation |
enum 文字列 | ❌ いいえ | mutation |
stored-procedureまたはQueryの下にMutation操作を表示するかどうかを指定します。
Note
{entity-name}.typeを stored-procedure に設定すると、新しい GraphQL 型executeXXXが自動的に作成されます。 この operation プロパティは、この型が GraphQL スキーマに配置される場所を制御します。 機能上の影響はなく、スキーマの検疫に過ぎません。
Format
{
"entities": {
"{entity-name}": {
"graphql": {
"operation": "query" | "mutation"
}
}
}
}
例: operation
operationが に設定されている場合query
type Query {
executeGetUserDetails(userId: Int!): GetUserDetailsResponse
}
operationが に設定されている場合mutation
type Mutation {
executeGetUserDetails(userId: Int!): GetUserDetailsResponse
}
有効 (GraphQL エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.graphql |
enabled |
boolean | ❌ いいえ | True |
開発者が GraphQL スキーマにエンティティを選択的に含めることができます。
Format
{
"entities": {
"{entity-name}": {
"graphql": {
"enabled": <true> (default) | <false>
}
}
}
}
REST (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.rest |
enabled |
boolean | ❌ いいえ | True |
entities.rest |
path |
文字列 | ❌ いいえ | /{entity-name} |
entities.{entity-name}.rest |
methods |
文字列配列 | ❌ いいえ* | POST |
* methods プロパティは、 stored-procedure エンドポイント専用です。
Note
このセクションで説明する Data API Builder 2.0 の機能は現在プレビュー段階であり、一般公開前に変更される可能性があります。 詳細については、「 バージョン 2.0 の新機能」を参照してください。
Format
{
"entities": {
"{entity-name}": {
"rest": {
"enabled": <true> (default) | <false>,
"path": <string; default: "{entity-name}">
}
}
}
}
説明 (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name} |
description |
文字列 | ❌ いいえ | None |
エンティティの人間が判読できる省略可能な説明。 この値は、生成された API ドキュメントと GraphQL スキーマのコメントとして表示されます。
Note
このセクションで説明する Data API Builder 2.0 の機能は現在プレビュー段階であり、一般公開前に変更される可能性があります。 詳細については、「 バージョン 2.0 の新機能」を参照してください。
Format
{
"entities": {
"{entity-name}": {
"description": "<string>"
}
}
}
Example
{
"entities": {
"Book": {
"description": "Represents a book in the catalog with title, author, and pricing information.",
"source": {
"object": "dbo.books",
"type": "table"
}
}
}
}
フィールド (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name} |
fields |
アレイ | ❌ いいえ | None |
エイリアス、説明、主キーの指定など、個々のデータベース フィールドのメタデータを定義します。
fields配列は、(mappings プロパティを介して) aliasと (source.key-fields プロパティを介して) primary-keyの両方を単一の統合された構造体に置き換えます。
Note
このセクションで説明する Data API Builder 2.0 の機能は現在プレビュー段階であり、一般公開前に変更される可能性があります。 詳細については、「 バージョン 2.0 の新機能」を参照してください。
入れ子になったプロパティ
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.fields[] |
name |
文字列 | ✔️ はい | None |
entities.{entity-name}.fields[] |
alias |
文字列 | ❌ いいえ | None |
entities.{entity-name}.fields[] |
description |
文字列 | ❌ いいえ | None |
entities.{entity-name}.fields[] |
primary-key |
boolean | ❌ いいえ | false |
Format
{
"entities": {
"{entity-name}": {
"fields": [
{
"name": "<database-field-name>",
"alias": "<api-exposed-name>",
"description": "<string>",
"primary-key": <boolean>
}
]
}
}
}
Example
{
"entities": {
"Book": {
"source": {
"object": "dbo.books",
"type": "table"
},
"fields": [
{
"name": "id",
"description": "Unique book identifier",
"primary-key": true
},
{
"name": "sku_title",
"alias": "title",
"description": "The display title of the book"
},
{
"name": "sku_status",
"alias": "status"
}
]
}
}
}
この例では、 id を主キーとして指定します ( source.key-fieldsの必要性を置き換えます)。一方、 sku_title と sku_status は title と status ( mappingsの必要性に置き換えます)。
Important
スキーマは、 fields が同じエンティティ上の mappings または source.key-fields と共存できないことを強制します。
fieldsに移行し、非推奨のプロパティを削除します。
マッピング (エンティティ名エンティティ)
Warnung
mappings プロパティは DAB 2.0 では非推奨です。 代わりに、 fields 配列を alias プロパティと共に使用してください。 スキーマは、 fields と mappings が同じエンティティ上で共存できないことを強制します。
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name} |
mappings |
オブジェクト | ❌ いいえ | None |
データベース オブジェクト フィールドのカスタム エイリアスまたは公開名を有効にします。
Important
GraphQL が有効になっているエンティティの場合、構成された公開名が GraphQL 名の要件を満たしている必要があります。
Format
{
"entities": {
"{entity-name}": {
"mappings": {
"<field-1-name>": "<field-1-alias>",
"<field-2-name>": "<field-2-alias>",
"<field-3-name>": "<field-3-alias>"
}
}
}
}
Examples
データベース テーブル
CREATE TABLE Books
(
id INT,
sku_title VARCHAR(50),
sku_status VARCHAR(50),
)
Configuration
{
"entities": {
"Books": {
...
"mappings": {
"sku_title": "title",
"sku_status": "status"
}
}
}
}
キャッシュ (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name} |
cache |
オブジェクト | ❌ いいえ | None |
エンティティのキャッシュを有効にして構成します。
入れ子になったプロパティ
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.cache |
enabled |
boolean | ❌ いいえ | False |
entities.{entity-name}.cache |
ttl-seconds |
整数 | ❌ いいえ | - |
entities.{entity-name}.cache |
level |
enum (L1 | L1L2) |
❌ いいえ | L1L2 |
Format
{
"entities": {
"{entity-name}": {
"cache": {
"enabled": <true> (default) | <false>,
"ttl-seconds": <integer; default: 5>,
"level": <"L1" | "L1L2"> (default: "L1L2")
}
}
}
}
level プロパティは、使用するキャッシュ層を制御します。
| 価値 | Description |
|---|---|
L1 |
メモリ内キャッシュのみ。 最も高速ですが、インスタンス間で共有されません。 |
L1L2 |
メモリ内キャッシュと分散 (Redis) キャッシュ。 スケールアウトされたインスタンス間で共有されます。 Default. |
Note
このセクションで説明する Data API Builder 2.0 の機能は現在プレビュー段階であり、一般公開前に変更される可能性があります。 詳細については、「 バージョン 2.0 の新機能」を参照してください。
Note
指定しない場合、 ttl-seconds は runtime.cache の下に設定されたグローバル値を継承します。
Example
{
"entities": {
"Author": {
"cache": {
"enabled": true,
"ttl-seconds": 30,
"level": "L1"
}
}
}
}
リレーションシップ (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name} |
relationships |
オブジェクト | ❌ いいえ | None |
GraphQL エンティティを他の公開エンティティと関連付ける方法を構成します。 詳細については、「データ API ビルダーのリレーションシップの内訳
Note
各リレーションシップの relationship-name プロパティは、そのエンティティのすべてのリレーションシップで一意である必要があります。
入れ子になったプロパティ
これらのプロパティは、リレーションシップのカーディナリティに応じて異なる組み合わせで使用されます。
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.relationships |
cardinality |
文字列 | ✔️ はい | None |
entities.{entity-name}.relationships |
target.entity |
文字列 | ✔️ はい | None |
entities.{entity-name}.relationships |
target.fields |
文字列配列 | ❌ いいえ | None |
entities.{entity-name}.relationships |
source.fields |
文字列配列 | ❌ いいえ | None |
entities.{entity-name}.relationships |
linking.object |
文字列 | ❌ いいえ | None |
entities.{entity-name}.relationships |
linking.source.fields |
文字列配列 | ❌ いいえ | None |
entities.{entity-name}.relationships |
linking.target.fields |
文字列配列 | ❌ いいえ | None |
Format
{
"entities": {
"{entity-name}": {
"relationships": {
"<relationship-name>": {
"cardinality": "one" | "many",
"target.entity": "<string>",
"source.fields": ["<string>"],
"target.fields": ["<string>"],
"linking.object": "<string>",
"linking.source.fields": ["<string>"],
"linking.target.fields": ["<string>"]
}
}
}
}
}
| Relationship | Cardinality | Example |
|---|---|---|
| one-to-many | many |
1 つのカテゴリ エンティティは、多くの todo エンティティに関連付けることができます |
| many-to-one | one |
多くの todo エンティティは、1 つのカテゴリ エンティティに関連付けることができます |
| many-to-many | many |
1 つの todo エンティティは多くのユーザー エンティティに関連付けることができ、1 つのユーザー エンティティは多くの todo エンティティに関連付けることができます |
例: 1 対 1 のカーディナリティ
各 Profile は正確に 1 つの Userに関連しており、各 User には 1 つの関連 Profileがあります。
{
"entities": {
"User": {
"relationships": {
"user_profile": {
"cardinality": "one",
"target.entity": "Profile",
"source.fields": [ "id" ],
"target.fields": [ "user_id" ]
}
}
},
"Profile": {
...
}
}
}
GraphQL スキーマ
type User
{
id: Int!
...
profile: Profile
}
Command-line
dab update User \
--relationship profile \
--target.entity Profile \
--cardinality one \
--relationship.fields "id:user_id"
例: 一対多カーディナリティ
Categoryには 1 つ以上の関連するBook エンティティを含めることができますが、各Bookには 1 つの関連するCategoryを含めることができます。
{
"entities": {
"Book": {
...
},
"Category": {
"relationships": {
"category_books": {
"cardinality": "many",
"target.entity": "Book",
"source.fields": [ "id" ],
"target.fields": [ "category_id" ]
}
}
}
}
}
GraphQL スキーマ
type Category
{
id: Int!
...
books: [BookConnection]!
}
コマンド ライン
dab update Category \
--relationship category_books \
--target.entity Book \
--cardinality many \
--relationship.fields "id:category_id"
例: 多対一カーディナリティ
多くの Book エンティティは、1 つの関連する Categoryを持つことができますが、 Category には 1 つ以上の関連する Book エントリを含めることができます。
{
"entities": {
"Book": {
"relationships": {
"books_category": {
"cardinality": "one",
"target.entity": "Category",
"source.fields": [ "category_id" ],
"target.fields": [ "id" ]
}
},
"Category": {
...
}
}
}
}
GraphQL スキーマ
type Book
{
id: Int!
...
category: Category
}
コマンド ライン
dab update Book \
--relationship books_category \
--target.entity "Category" \
--cardinality one \
--relationship.fields "category_id:id"
例: 多対多カーディナリティ
多くの Book エンティティには多くの関連 Author エンティティを含めることができますが、多くの Author エンティティには多くの関連する Book エントリを含めることができます。
Note
このリレーションシップは、dbo.books_authorsと言う 3 つ目のテーブルで可能です。
{
"entities": {
"Book": {
"relationships": {
...,
"books_authors": {
"cardinality": "many",
"target.entity": "Author",
"source.fields": [ "id" ],
"target.fields": [ "id" ],
"linking.object": "dbo.books_authors",
"linking.source.fields": [ "book_id" ],
"linking.target.fields": [ "author_id" ]
}
},
"Category": {
...
},
"Author": {
...
}
}
}
}
GraphQL スキーマ
type Book
{
id: Int!
...
authors: [AuthorConnection]!
}
type Author
{
id: Int!
...
books: [BookConnection]!
}
コマンド ライン
dab update Book \
--relationship books_authors \
--target.entity "Author" \
--cardinality many \
--relationship.fields "id:id" \
--linking.object "dbo.books_authors" \
--linking.source.fields "book_id" \
--linking.target.fields "author_id"
正常性 (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name} |
health |
オブジェクト | ❌ いいえ | None |
エンティティの正常性チェックを有効にして構成します。
入れ子になったプロパティ
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.health |
enabled |
boolean | ❌ いいえ | true |
entities.{entity-name}.health |
first |
整数 | ❌ いいえ | 100 |
entities.{entity-name}.health |
threshold-ms |
整数 | ❌ いいえ | 1000 |
Example
{
"entities": {
"Book": {
"health": {
"enabled": true,
"first": 3,
"threshold-ms": 500
}
}
}
}
Note
first値は、runtime.pagination.max-page-size設定以下である必要があります。 値を小さくすると、正常性チェックの完了時間が短縮されます。
Important
ストアド プロシージャは、パラメーターを必要とし、決定論的ではない可能性があるため、エンティティの正常性チェックから自動的に除外されます。
MCP (エンティティ名エンティティ)
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name} |
mcp |
オブジェクト | ❌ いいえ | 省略すると、既定で有効になります |
エンティティの MCP 参加を制御します。 MCP がグローバルに有効になっている場合、エンティティは既定で参加します。 このプロパティを使用して、ストアド プロシージャ エンティティのカスタム MCP ツールをオプトアウトまたは有効にします。
Note
このセクションで説明する Data API Builder 2.0 の機能は現在プレビュー段階であり、一般公開前に変更される可能性があります。 詳細については、「 バージョン 2.0 の新機能」を参照してください。
オブジェクトの形式
詳細な制御には、オブジェクト形式を使用します。
| Parent | Property | タイプ | Required | Default |
|---|---|---|---|---|
entities.{entity-name}.mcp |
dml-tools |
boolean | ❌ いいえ | true |
entities.{entity-name}.mcp |
custom-tool |
boolean | ❌ いいえ | false |
{
"entities": {
"Book": {
"mcp": {
"dml-tools": true
}
}
}
}
カスタム ツール (ストアド プロシージャのみ)
ストアド プロシージャ エンティティの場合は、 custom-tool を true に設定して、プロシージャを名前付き MCP ツールとして登録します。
{
"entities": {
"GetBookById": {
"source": {
"type": "stored-procedure",
"object": "dbo.get_book_by_id"
},
"mcp": {
"custom-tool": true
},
"permissions": [
{
"role": "anonymous",
"actions": ["execute"]
}
]
}
}
}
Important
custom-tool プロパティは、ストアド プロシージャ エンティティに対してのみ有効です。 テーブルまたはビュー エンティティに設定すると、構成エラーが発生します。
CLI の例
dab add Book --source books --permissions "anonymous:*" --mcp.dml-tools true
dab add GetBookById --source dbo.get_book_by_id --source.type stored-procedure --permissions "anonymous:execute" --mcp.custom-tool true