Skip to content

Simplify accessing data returned by Admin API methods #51

@fordN

Description

@fordN

Many of the objects returned from Admin API methods require accessing a property to see the list returned. While not complex this often leads to several steps for me to get to the data I need in a clean view.
For me a common pattern is using an iterator to access items in the returned list, so without changing the data structure or generated model code we can make that workflow more ergonomic by implementing iterators.

Example code

Current:

datasets = client.datasets.list_all()

for dataset in datasets.datasets:
    print(f"{dataset.namespace}/{dataset.name}@{dataset.latest_version}")
    print(f"  Available versions: {dataset.versions}")

Proposed:

datasets = client.datasets.list_all()

for dataset in datasets:
    print(f"{dataset.namespace}/{dataset.name}@{dataset.latest_version}")
    print(f"  Available versions: {dataset.versions}")

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions