Skip to content

Add datasource datapoint lookup by path - #717

Open
sirajhoshan wants to merge 1 commit into
DagsHub:mainfrom
sirajhoshan:feature/get-datapoint-by-path
Open

Add datasource datapoint lookup by path#717
sirajhoshan wants to merge 1 commit into
DagsHub:mainfrom
sirajhoshan:feature/get-datapoint-by-path

Conversation

@sirajhoshan

Copy link
Copy Markdown

Summary

  • add Datasource.get_datapoint(path) for direct datapoint lookup
  • reuse the existing path filtering mechanism
  • fetch at most one matching datapoint
  • preserve KeyError when the requested path does not exist
  • add tests for both found and missing paths

Tests

  • PYTHONPATH="$PWD" python -m pytest tests/data_engine/test_datasource.py -q
  • PYTHONPATH="$PWD" python -m pytest tests/data_engine/test_querying.py tests/data_engine/test_queryresult.py tests/data_engine/test_datapoint.py -q
  • python -m black --check dagshub/data_engine/model/datasource.py tests/data_engine/test_datasource.py
  • git diff --check

Fixes #365

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 46b603c4-9e9a-447f-866f-137e354d8e95

📥 Commits

Reviewing files that changed from the base of the PR and between 733227f and ad54024.

📒 Files selected for processing (2)
  • dagshub/data_engine/model/datasource.py
  • tests/data_engine/test_datasource.py

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.

📜 Recent review details
🔇 Additional comments (2)
dagshub/data_engine/model/datasource.py (1)

340-343: LGTM!

tests/data_engine/test_datasource.py (1)

285-313: LGTM!

Also applies to: 316-328


📝 Walkthrough

Walkthrough

Datasource now provides get_datapoint(path) to query one datapoint by path. Tests cover the matching result and the KeyError raised when no datapoint exists.

Changes

Datapoint path lookup

Layer / File(s) Summary
Path lookup API and validation
dagshub/data_engine/model/datasource.py, tests/data_engine/test_datasource.py
Datasource.get_datapoint filters by path, limits the query to one result, returns the matching Datapoint, and raises KeyError when no result exists. Tests verify both cases and inspect the query filter.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to ad540

This PR adds a localized datapoint lookup method with missing-path handling and focused tests; no actionable merge-blocking risk remains after normal checks and review.

Poem

I hop through paths where datapoints hide,
One query brings the right one inside.
If none is found, a key error calls,
The rabbit approves these tidy halls. 🐇

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding datapoint lookup by path to Datasource.
Description check ✅ Passed The description directly explains the new lookup method, its behavior, tests, and validation commands.
Linked Issues check ✅ Passed The implementation satisfies issue #365 by adding direct datapoint retrieval through path filtering and preserving KeyError for missing paths.
Out of Scope Changes check ✅ Passed The changes are limited to the requested Datasource method and focused tests for successful and missing path lookups.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (redundant_comments). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

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.

Data Engine: Get datapoint via its path

2 participants