Feature Request: Support OData Deep Inserts in create() and upsert()
@sagebree がすでに取り組んでいます。
2026年4月21日 から。
評価
この issue はまだ評価されていません。
説明
Summary
Add support for OData deep inserts in client.records.create() and client.records.upsert(), allowing parent and related child records to be created/upserted in a single API call.
Motivation
When importing data that involves a parent record and its related child records (e.g. via one-to-many relationships), the current SDK requires separate API calls for each table — first creating the parent, then creating each child record individually with a foreign key reference back to the parent. This is both verbose and inefficient, especially for bulk import scenarios.
The Dataverse Web API already natively supports deep inserts, where related records can be nested inside the parent payload using navigation property names. For example:
{
"name": "Sample Account",
"primarycontactid": {
"firstname": "John",
"lastname": "Smith"
},
"contact_customer_accounts": [
{ "firstname": "Jane", "lastname": "Doe" },
{ "firstname": "Bob", "lastname": "Jones" }
]
}
The SDK does not currently surface this capability. Attempting to pass nested dicts/lists in the record payload will not work correctly because _create() lowercases all keys via _lowercase_keys(), which breaks case-sensitive navigation property names.
Proposed Behavior
Allow create() and upsert() to accept nested dicts (for single-valued navigation properties) and lists of dicts (for collection-valued navigation properties) within the record payload. Navigation property keys should be preserved as-is (case-sensitive) and not lowercased.
Example usage:
# Deep insert: create parent + children in one call
client.records.create("account", {
"name": "Contoso Ltd",
"primarycontactid": {
"firstname": "John",
"lastname": "Smith"
},
"contact_customer_accounts": [
{"firstname": "Jane", "lastname": "Doe"},
{"firstname": "Bob", "lastname": "Jones"},
]
})
Current Workaround
Create parent and child records in separate calls, manually managing the foreign key references:
parent_id = client.records.create("account", {"name": "Contoso Ltd"})
client.records.create("contact", {
"firstname": "Jane",
"lastname": "Doe",
"parentcustomerid_account@odata.bind": f"/accounts({parent_id})"
})
Additional Context
- The Dataverse Web API documentation confirms deep insert support for both
POST(create) andPATCH(upsert) operations. - The
_lowercase_keys()call in_create()would need to distinguish between column names (which should be lowercased) and navigation property names (which are case-sensitive and should be preserved). CreateMultiple/UpsertMultiplebulk operations may also benefit from this, depending on API support for deep inserts in batch payloads.
- 主要言語
- Python
- スター
- 60
- フォーク
- 23
- 平均マージ
- 13時間 53分
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PowerPlatform-DataverseClient-Python のほかの issue
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
-
enhancement
microsoft/PowerPlatform-DataverseClient-Python#194 · 担当者 1 名 ·
-
microsoft/PowerPlatform-DataverseClient-Python#170 · 担当者 1 名 ·
microsoft/PowerPlatform-DataverseClient-Python の issue をすべて見る
似ている issue
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100