microsoft / microsoft/PowerPlatform-DataverseClient-Python

tables.update_column / update_columns: update existing column constraints (retrieve -> PUT + @odata.type) -- no metadata-write path exists today

Ouverte
#202 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

enhancement
Langage dominant
Python
Étoiles
60
Forks
23
Merge moyen
13 h 53 min
PR mergées (30 j)
3

Description

Summary

client.tables can create, add_columns, and remove_columns, but there is no way to update an existing column's definition -- MaxLength, MinValue/MaxValue, RequiredLevel, DisplayName, Format, etc. Today a caller who needs to widen a text column or change a required level must drop to the raw Web API PUT EntityDefinitions({id})/Attributes({id}) and hand-build the payload, including the derived @odata.type discriminator.

This is also the only place the counter-intuitive PUT-not-PATCH metadata-update contract is exposed to users. Metadata updates go over PUT with merge semantics (partial payloads are honored), which reads like PATCH behavior on the PUT verb. The right fix is not a platform verb change (that is a long pole) -- it is to hide the verb inside the SDK so users never choose it.

Context: parity with the .NET modern client

Microsoft.PowerPlatform.Dataverse.Client.ServiceClient never hits this, because it rides the Organization Service message contracts (Execute(new UpdateAttributeRequest { Attribute = new StringAttributeMetadata { MaxLength = 4000 } })) -- a typed message, no HTTP verb. The Python SDK is Web-API-bound and cannot borrow those contracts, so it should own the retrieve -> modify -> PUT (+ @odata.type) sequence internally to give the same UX (typed fields in, no verb visible).

Proposed change (backward-compatible)

Add update_column (+ update_columns) that accepts the same dict override schema proposed in #194, so create and update share one spec shape:

client.tables.update_column("cfb_CustomerFeedback", "cfb_Comment",
                            {"max_length": 4000, "display_name": "Customer Comment"})

Internally: GET the existing typed attribute -> apply overrides -> PUT back with the correct derived @odata.type. Never expose PUT/PATCH/@odata.type to the caller.

Touchpoints

  • data/_odata.py -- new _update_attribute (retrieve-then-PUT with @odata.type); reuse _odata_base.py::_attribute_payload override-building from #194.
  • operations/tables.py + aio/operations/async_tables.py -- new update_column / update_columns.
  • Unit tests: override application + correct verb / @odata.type on the outbound request.
  • README + CHANGELOG per repo maintenance rules.

Acceptance

  • update_column(..., {"max_length": 4000}) issues a PUT to EntityDefinitions({id})/Attributes({id}) with MaxLength: 4000 and the correct derived @odata.type.
  • Caller never passes a verb or @odata.type.
  • Depends on / shares the override-spec schema from #194.

Related

  • #194 -- create-time column constraints (in progress).
  • microsoft/Dataverse-skills#119 -- documents the raw Web API metadata contract this method replaces.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par data/_odata.py et _odata_base.py::_attribute_payload, puis examinez les opérations sur les tables dans operations/tables.py et aio/operations/async_tables.py. Vérifiez l’application de l’override et la requête PUT sortante dans les tests unitaires, y compris le @odata.type dérivé ; mettez à jour la README et CHANGELOG si nécessaire. Confirmez que l’implémentation partage le schéma d’override de #194 et conserve le verbe et le discriminator en interne.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
api, backend
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
68/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.