Skip to content

List tables API gives one more (empty) page and terminates with empty string page_token instead of null #21

@jaychia

Description

@jaychia

When performing a tables.list operation, it seems that the server returns the empty string "" instead of None as documented in the spec.

image

On a default run of unity catalog:

!pip install unitycatalog

import unitycatalog

client = unitycatalog.Unitycatalog(base_url="http://127.0.0.1:8080/api/2.1/unity-catalog/")
response = client.tables.list(catalog_name="unity", schema_name="default")

# assert response.next_page_token is None, f"This will fail, with a non-empty token: {response.next_page_token}"

response = client.tables.list(catalog_name="unity", schema_name="default", page_token=response.next_page_token)
# assert len(response.tables) > 0, "This will fail, because response has no tables"

# assert response.next_page_token is None, f"This will fail, with empty token: {response.next_page_token}"

This led to an unexpected infinite loop on my client-side code! Expected behavior: return null for the token when the page stream is exhausted.

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