microsoft / microsoft/PowerPlatform-DataverseClient-Python

Typed column metadata reads via RetrieveMetadataChanges (one request, no @odata.type cast round-trip)

Abierto
#203 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

enhancement
Lenguaje dominante
Python
Estrellas
60
Forks
23
Merge medio
13 h 53 min
PR fusionados (30 d)
3

Descripción

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(...) issuing GET RetrieveMetadataChanges(Query=@p1)?@p1={...} with an EntityQueryExpression + AttributeQuery.Properties projection.
  • operations/tables.py + async twin -- typed=True on list_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. MaxLength on string/memo, MinValue/MaxValue on int) in a single request, no @odata.type URL 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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza en data/_odata.py e inspecciona la ruta de conversión de metadata existente; después sigue list_columns y get_column en operations/tables.py y su equivalente asíncrono. Añade cobertura de unit tests para la forma de la solicitud, la proyección, los criterios y el mapeo tipado de RetrieveMetadataChanges, y actualiza también README y CHANGELOG. Se considera terminado cuando las lecturas tipadas devuelvan propiedades como MaxLength o MinValue/MaxValue en una sola solicitud, manteniendo la ruta de conversión existente como fallback.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, backend
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
55/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.