Skip to content

entity_tag_assignments.list does not URL-encode entity names containing "/" (e.g. column "Inferences/Second") #1493

Description

@ozielDBX

Description

Unity Catalog allows column names that contain a forward slash / (for example a column named `Inferences/Second`, created with delta.columnMapping.mode='name'). The Entity Tag Assignments API takes the fully-qualified entity_name as a single path segment, so any / in the name must be percent-encoded (%2F).

WorkspaceClient().entity_tag_assignments.list(...) interpolates entity_name into the request path without URL-encoding it. The raw / is sent on the wire, splits the path into extra segments, matches no route, and the call fails with NotFound: No API found ... — before Unity Catalog ever resolves the entity.

The server side is correct: an equivalent request with the name percent-encoded (Inferences%2FSecond) returns 200 with the expected tag. Only the SDK's client-side path construction is at fault.

Source (databricks/sdk/service/catalog.py, EntityTagAssignmentsAPI.list):

json = self._api.do(
    "GET",
    f"/api/2.1/unity-catalog/entity-tag-assignments/{entity_type}/{entity_name}/tags",
    query=query,
    headers=headers,
)

entity_name is interpolated directly, with no urllib.parse.quote(...). This is the same root cause as #1266 (tables.get not encoding %), on a different method — so the encoding gap appears systemic across UC path parameters, not specific to one call.

Reproduction

import urllib.parse
from databricks.sdk import WorkspaceClient
from databricks.sdk.errors import NotFound

w = WorkspaceClient(profile="my-profile")

# A UC table with a column literally named `Inferences/Second`, tagged e.g. env=demo.
full = "main.my_schema.my_table.Inferences/Second"

try:
    list(w.entity_tag_assignments.list(entity_type="columns", entity_name=full))  # Fails
except NotFound as e:
    print(e)
    safe = urllib.parse.quote(full, safe="")   # main.my_schema.my_table.Inferences%2FSecond
    # A direct REST call with `safe` returns 200; the real fix is for the SDK to encode internally.

Expected behavior

The SDK should percent-encode path parameters such as entity_name so entity names containing URL-reserved characters (/, %, #, ?, space, …) resolve correctly. UC permits these names, so the SDK should be able to address them. A raw / should not produce an unroutable request.

Is it a regression?

Not that I'm aware of — the affected method has never encoded the path parameter. Reproduced on 0.120.0; not previously working on an earlier version I tried.

Debug Logs

With logging.basicConfig(level=logging.DEBUG) (workspace/table names redacted):

DEBUG:databricks.sdk:GET /.well-known/databricks-config
DEBUG:urllib3.connectionpool:https://<workspace>.cloud.databricks.com:443 "GET /api/2.1/unity-catalog/entity-tag-assignments/columns/main.my_schema.my_table.Inferences/Second/tags HTTP/1.1" 404 None
DEBUG:databricks.sdk:GET /api/2.1/unity-catalog/entity-tag-assignments/columns/main.my_schema.my_table.Inferences/Second/tags
< "message": "No API found for 'GET /unity-catalog/entity-tag-assignments/columns/main.my_schema.my_table.Inferences/Second/tags'"
NotFound: No API found for 'GET /unity-catalog/entity-tag-assignments/columns/main.my_schema.my_table.Inferences/Second/tags'

Note the logged request line contains a raw / in the column name — it should be %2F.

Other Information

  • OS: macOS 26.5.2 (arm64)
  • Version: databricks-sdk 0.120.0, Python 3.14.2

Additional context

Confirmed via curl that the server accepts the encoded form (client-side bug only):

Path segment for the column HTTP Result
…inferences_per_second (control column) 200 returns the tag
…Inferences/Second (raw /) 404 No API found (this bug)
…Inferences%2FSecond (percent-encoded) 200 returns the tag ✅
…Inferences%252FSecond (double-encoded) 404 Column 'Inferences%2FSecond' does not exist

The same failure and %2F workaround also reproduce through the Databricks CLI v0.296.0 (databricks entity-tag-assignments list columns <fqn>), which uses the Go SDK — so the encoding gap is not limited to the Python SDK. Related: #1266.

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