microsoft / microsoft/PowerPlatform-DataverseClient-Python
Typed column metadata reads via RetrieveMetadataChanges (one request, no @odata.type cast round-trip)
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 60
- Fork
- 23
- Merge medio
- 13h 53m
- PR unite (30g)
- 3
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da data/_odata.py e ispeziona il percorso esistente di cast dei metadata, quindi segui list_columns e get_column in operations/tables.py e il loro equivalente asincrono. Aggiungi la copertura di unit test per la forma della richiesta RetrieveMetadataChanges, la proiezione, i criteri e il mapping tipizzato, quindi aggiorna anche README e CHANGELOG. Il lavoro è completo quando le letture tipizzate restituiscono proprietà come MaxLength o MinValue/MaxValue in un'unica richiesta, mantenendo il percorso di cast esistente come fallback.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- api, backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 55/100