astropy / astropy/pyvo

DatalinkRecordMixin's record.getdataset() falls back to access_url

Open
#776 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
88
Forks
64
Avg merge
38m
Merged PRs (30d)
1

Description

## Description

`DatalinkRecordMixin.getdataset()` catches any failure in the DataLink path and falls back to the base `Record.getdataset()`:
https://github.com/astropy/pyvo/blob/a7c6e6c22792189d1ed74eb0db09cb56df13bf1a/pyvo/dal/adhoc.py#L435-L447

The fallback fetches the record's `access.reference` column without checking the `access_format`, which may cause confusion for services that follow the Datalink-indirection model where `access_url` points at a DataLink links endpoint insstead of the data product directly.
So in this scenario, if the first request fails the fallback will fetch the links endpoint and return the VOTable as the **dataset**, and the user doesn't get any error messages they could otherwise use to discover what went wrong.

Also, note that this path reads `.access_url` directly instead of `getdataurl()` which will make error rows lead to a misleading error.

I think we need to fix this by:
- Skip the fallback when the record's access_format indicates a DataLink document
- Propagate the error_message from a DataLink error row instead of swallowing it?

If this seems reasonable and I'm not missing something I'm happy to put in a PR

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in pyvo/dal/adhoc.py at DatalinkRecordMixin.getdataset(), especially the fallback around lines 435-447, and trace the DataLink error-row handling and Record.getdataset(). Check the existing tests for DatalinkRecordMixin behavior. Done means DataLink documents are not returned as datasets after a failed request, and relevant DataLink error information is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.