microsoft / microsoft/PowerPlatform-DataverseClient-Python
Typed column metadata reads via RetrieveMetadataChanges (one request, no @odata.type cast round-trip)
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 60
- フォーク
- 23
- 平均マージ
- 13時間 53分
- マージ済み PR(30日)
- 3
説明
Summary
Reading type-specific column properties over /EntityDefinitions is a two-step dance: first read the generic attribute to get AttributeType/@odata.type, then re-issue a second GET with a derived-type URL cast (/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata) to project the typed fields. The SDK does exactly this today (e.g. _bulk_fetch_picklists, extra_select="@odata.type,AttributeType").
Context: what the .NET modern client gives for free
ServiceClient gets fully-typed, polymorphic AttributeMetadata derived objects back in one RetrieveEntity/RetrieveAllEntities call and the caller just downcasts (attr is StringAttributeMetadata s). No second request, no discriminator juggling.
Proposed change
Add a typed read path backed by the Web API RetrieveMetadataChanges function -- the closest Web-API analog to the .NET single-request typed retrieve. It returns derived typed attributes in one call and supports property projection (via the query's AttributeQuery.Properties), so callers get small, typed payloads without the cast round-trip.
cols = client.tables.list_columns("account", typed=True) # typed values, one request
col = client.tables.get_column("account", "emailaddress1", typed=True)
Why this does not need a platform change
Payload size is controlled by the query's property projection, so the platform "omit null fields" ask is not a blocker -- we simply project only the properties we need. (Note: the .NET client itself uses plain Retrieve* + a client cache rather than RetrieveMetadataChanges; for a Web-API client wanting small typed payloads, RetrieveMetadataChanges with projection is the better fit. Design discussion welcome.)
Touchpoints
data/_odata.py-- new_retrieve_metadata_changes(...)issuingGET RetrieveMetadataChanges(Query=@p1)?@p1={...}with anEntityQueryExpression+AttributeQuery.Propertiesprojection.operations/tables.py+ async twin --typed=Trueonlist_columns/get_column(keep the existing cast path as fallback).- Unit tests: request shape (projection, criteria) + typed mapping.
- README + CHANGELOG.
Acceptance
list_columns(typed=True)returns typed values (e.g.MaxLengthon string/memo,MinValue/MaxValueon int) in a single request, no@odata.typeURL cast.- Property projection limits the payload to requested properties.
Related
- #194 -- create-time column constraints (in progress).
- microsoft/Dataverse-skills#119 -- documents the current two-step typed-read workaround.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
data/_odata.py から始めて、既存の metadata cast path を調査し、次に operations/tables.py の list_columns と get_column、およびそれらの async twin を追跡します。RetrieveMetadataChanges の request shape、projection、criteria、typed mapping を対象とする unit coverage を追加し、README と CHANGELOG も更新します。typed reads が 1 回の request で MaxLength や MinValue/MaxValue などのプロパティを返し、既存の cast path が fallback として維持されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api, backend
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 55/100