Skip to content

Resolve issue with AttributeError during update of Serving Endpoint tags#713

Open
pivoshenko wants to merge 28 commits intodatabricks:mainfrom
pivoshenko:main
Open

Resolve issue with AttributeError during update of Serving Endpoint tags#713
pivoshenko wants to merge 28 commits intodatabricks:mainfrom
pivoshenko:main

Conversation

@pivoshenko
Copy link

@pivoshenko pivoshenko commented Jul 18, 2024

Hi, thanks for the SDK it's really useful! I noticed today that when you try to update tags in the serving endpoint using the patch method it fails with AttributeError. The fix is very straightforward. 🐱

Changes

I just updated the way how responses are unpacked and passed into EndpointTag

Tests

I tested it using my personal dev account.

  • make test run locally
  • make fmt applied
  • relevant integration tests applied

Thanks!

…int tags

Signed-off-by: Volodymyr Pivoshenko <volodymyr.pivoshenko@gmail.com>
@pivoshenko pivoshenko changed the title Resolve issue with AttributeError during update of serving endpoint tags Resolve issue with AttributeError during update of Serving Endpoint tags Jul 18, 2024
@pivoshenko
Copy link
Author

Hi @nfx, @mgyucht! Sorry for tagging you directly, can you please review this PR? 😉

@pivoshenko
Copy link
Author

Hi @nfx, @mgyucht! Sorry for tagging you directly again, can you please check this PR? 😉
Thanks!

@github-actions
Copy link

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

Copilot AI review requested due to automatic review settings March 2, 2026 20:43
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 713
  • Commit SHA: d6a887ff4acb279d3b27b7bc16eda6990349cbce

Checks will be approved automatically on success.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the serving endpoint tags patch response handling that currently raises an AttributeError, and adds GitHub label management automation for the repository.

Changes:

  • Adjust serving endpoint tag patch() response parsing in serving.py.
  • Add a GitHub Actions workflow to sync repository labels from a YAML definition.
  • Add a .github/labels.yaml label definition file.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

File Description
databricks/sdk/service/serving.py Changes how the tags PATCH response is deserialized/returned.
.github/workflows/labels.yaml Adds a workflow to update GitHub labels on pushes to main.
.github/labels.yaml Defines the repository label set to be applied by the workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


res = self._api.do('PATCH', f'/api/2.0/serving-endpoints/{name}/tags', body=body, headers=headers)
return EndpointTags.from_dict(res)
return [EndpointTag.from_dict(v) for v in res["tags"]]
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch() is annotated/documented to return EndpointTags, but the implementation now returns a bare List[EndpointTag]. This is a breaking API change for callers expecting an EndpointTags object (e.g., accessing .tags) and also makes the method behavior inconsistent with its docstring/type hints. Consider keeping the EndpointTags return type and adapting the response parsing inside that wrapper (also preserving the previous behavior of returning an empty list when the response has no tags field instead of raising KeyError).

Suggested change
return [EndpointTag.from_dict(v) for v in res["tags"]]
return EndpointTags(tags=[EndpointTag.from_dict(v) for v in res.get("tags", [])])

Copilot uses AI. Check for mistakes.

res = self._api.do('PATCH', f'/api/2.0/serving-endpoints/{name}/tags', body=body, headers=headers)
return EndpointTags.from_dict(res)
return [EndpointTag.from_dict(v) for v in res["tags"]]
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EndpointTags.from_dict(res) already deserializes res['tags'] by calling EndpointTag.from_dict for each element (via _repeated_dict). Replacing it with a manual list comprehension doesn’t materially change how individual tags are unpacked when res['tags'] is a list, but it does drop the EndpointTags wrapper and loses the helper’s safer handling for missing/empty fields. If the goal is to fix an AttributeError, it’s worth adjusting the model/deserializer to match the real response shape rather than duplicating the same loop here.

Suggested change
return [EndpointTag.from_dict(v) for v in res["tags"]]
return EndpointTags.from_dict(res)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants