Skip to content

docs(datasets): document asymmetric NotFoundError vs None behavior for get_dataset#495

Draft
thiagobomfin-galileo wants to merge 1 commit intomainfrom
fix/sc-55067/docs-get-dataset
Draft

docs(datasets): document asymmetric NotFoundError vs None behavior for get_dataset#495
thiagobomfin-galileo wants to merge 1 commit intomainfrom
fix/sc-55067/docs-get-dataset

Conversation

@thiagobomfin-galileo
Copy link
Contributor

@thiagobomfin-galileo thiagobomfin-galileo commented Mar 6, 2026

User description

Shortcut:
get_dataset by ID throws NotFoundError but by name returns None

Description:

  • Document the inconsistent lookup behavior of get_dataset / Datasets.get / Dataset.get
    across both the classic and future SDK APIs:
  • By ID: the underlying API performs a direct GET /datasets/{id} request, which returns
    HTTP 404 when not found — causing a NotFoundError to be raised before the SDK can intercept
    it
  • By name: the underlying API performs a filtered list query, which returns an empty list
    when not found — causing the SDK to return None instead of raising

Notes

This is a documentation-only change. The behavior itself is not modified — this PR makes
the asymmetry explicit so callers know what to expect and can handle both cases correctly:

  # By name — check for None
  dataset = get_dataset(name="my-dataset")
  if dataset is None:
      ...

  # By ID — catch NotFoundError
  from galileo.exceptions import NotFoundError
  try:
      dataset = get_dataset(id="dataset-123")
  except NotFoundError:
      ...

Tests:

  • Unit Tests Added
  • E2E Test Added (if it's a user-facing feature, or fixing a bug)

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Clarify dataset lookup behavior in Datasets.get by documenting that ID queries raise NotFoundError while name queries return None, so callers know what to expect. Describe the same asymmetry in the future Dataset.get method so future-API consumers can decide whether to catch the exception or handle a None return value.

Latest Contributors(2)
UserCommitDate
bipin@galileo.aifix-normalize-ground_t...February 18, 2026
vamaq@users.noreply.gi...fix-dataset-204-respon...February 07, 2026
This pull request is reviewed by Baz. Review like a pro on (Baz).

@thiagobomfin-galileo thiagobomfin-galileo self-assigned this Mar 6, 2026
@thiagobomfin-galileo thiagobomfin-galileo requested a review from a team as a code owner March 6, 2026 16:00
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.06%. Comparing base (5a7c747) to head (55378c1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #495      +/-   ##
==========================================
+ Coverage   82.00%   82.06%   +0.05%     
==========================================
  Files          96       96              
  Lines        9260     9260              
==========================================
+ Hits         7594     7599       +5     
+ Misses       1666     1661       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thiagobomfin-galileo thiagobomfin-galileo marked this pull request as draft March 6, 2026 16:50
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.

1 participant