Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dataset-catalog-client/catalog_client/client/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def _create_or_update(
canonical_id=dataset.canonical_id,
version=dataset.version,
project=dataset.project,
exclude_tombstoned=False,
limit=10, # reasonable limit for duplicates check
)
existing_datasets = results.results
Expand All @@ -146,13 +147,12 @@ def _create_or_update(
f"Multiple datasets found ({len(existing_datasets)}) for {dataset_ref!r}"
)

existing_dataset = existing_datasets[0]
if update_if_exists:
existing_dataset = existing_datasets[0]
self.datasets.update(existing_dataset.id, dataset)
return existing_dataset.id

# Default: return existing dataset ID without error
return existing_datasets[0].id
return existing_dataset.id


class AsyncCatalogClient:
Expand Down
27 changes: 17 additions & 10 deletions dataset-catalog-client/catalog_client/client/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ def _build_list_params(
version: str | None,
modality: DatasetModality | None,
project: str | None,
is_latest: bool | None,
is_latest: bool,
include_lineage: bool,
include_collections: bool,
exclude_tombstoned: bool,
offset: int,
limit: int,
) -> dict:
params: dict = {"offset": offset, "limit": limit}
params: dict = {
"offset": offset,
"limit": limit,
"include_lineage": include_lineage,
"include_collections": include_collections,
"exclude_tombstoned": exclude_tombstoned,
"is_latest": is_latest,
}
if canonical_id is not None:
params["canonical_id"] = canonical_id
if version is not None:
Expand All @@ -36,12 +44,6 @@ def _build_list_params(
params["modality"] = modality.value
if project is not None:
params["project"] = project
if is_latest is not None:
params["is_latest"] = is_latest
if include_lineage:
params["include_lineage"] = True
if include_collections:
params["include_collections"] = True
return params


Expand All @@ -53,9 +55,10 @@ def list(
version: str | None = None,
modality: DatasetModality | None = None,
project: str | None = None,
is_latest: bool | None = None,
is_latest: bool = True,
include_lineage: bool = False,
include_collections: bool = False,
exclude_tombstoned: bool = True,
offset: int = 0,
limit: int = 100,
) -> PaginatedResponse[DatasetWithRelationsResponse]:
Expand All @@ -67,6 +70,7 @@ def list(
is_latest,
include_lineage,
include_collections,
exclude_tombstoned,
offset,
limit,
)
Expand All @@ -81,6 +85,7 @@ def _resolve(self, ref: DatasetRef) -> str:
project=ref.project,
version=ref.version,
limit=10,
exclude_tombstoned=False,
)
result = response.results
if len(result) == 0:
Expand Down Expand Up @@ -130,9 +135,10 @@ async def list(
version: str | None = None,
modality: DatasetModality | None = None,
project: str | None = None,
is_latest: bool | None = None,
is_latest: bool = True,
include_lineage: bool = False,
include_collections: bool = False,
exclude_tombstoned: bool = True,
offset: int = 0,
limit: int = 100,
) -> PaginatedResponse[DatasetWithRelationsResponse]:
Expand All @@ -144,6 +150,7 @@ async def list(
is_latest,
include_lineage,
include_collections,
exclude_tombstoned,
offset,
limit,
)
Expand Down
Loading