Skip to content

semantic-layer edit: use the metastore PATCH instead of a whole-record PUT #833

Open

Description

@Matovidlo

Follow-up from the review of #778 (soustruh, 2026-10-06).

semantic-layer edit (edit_simple, edit_metric_with_cascade in services/_semantic_layer_crud.py) copies every current attribute, applies the change and sends a whole-record put_item. A change another caller makes to a different key between the read and the PUT is overwritten.

The metastore has a PATCH /api/v1/repository/{type}/{id} that merges only the top-level data keys of the request (simpleJSONMerge), in one transaction under a row lock. #778 adds MetastoreClient.patch_item(item_type, item_id, *, name=None, data=None).

Proposed:

  • semantic-layer edit: send patch_item with only the changed keys (for the metric-rename cascade: only metrics). The reads stay: they resolve the item by name and drive the cascade.
  • import --overwrite and promote keep put_item: they must make the target equal to the source, and a PATCH would keep keys that exist only in the target.
  • Note: the PATCH validates only the keys it receives, never the merged record, so the merged item must still be validated client-side.
  • Correct the 0.41.10 changelog statement that "the metastore has no PATCH endpoint" where it is relied on in docs/comments (the route exists in go-monorepo since at least b84391fa, 2025-07-02).

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions