microsoft / microsoft/PowerPlatform-DataverseClient-Python

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

Đang mở
#202 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

enhancement
Ngôn ngữ chính
Python
Star
60
Fork
23
Merge trung bình
13 giờ 53 phút
Pull request đã merge (30 ngày)
3

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với data/_odata.py và _odata_base.py::_attribute_payload, sau đó kiểm tra các thao tác bảng trong operations/tables.py và aio/operations/async_tables.py. Xác minh việc áp dụng override và yêu cầu PUT gửi đi trong các bài kiểm thử đơn vị, bao gồm @odata.type được suy ra; cập nhật README và CHANGELOG khi cần. Xác nhận rằng phần triển khai dùng chung schema override từ #194 và giữ verb cùng discriminator ở phạm vi nội bộ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api, backend
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
68/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.