astropy / astropy/pyvo

SODA processed() does not inspect external datalinks any more

Open
#660 0 comments 0 reactions 0 assignees View on GitHub
bug component: dal
Dominant language
Python
Stars
88
Forks
64
Avg merge
38m
Merged PRs (30d)
1

Description

Consider this script:

```
import pyvo

svc = pyvo.dal.tap.TAPService("http://dc.g-vo.org/tap")
for rec in svc.run_sync(
"SELECT TOP 1 califaid, obs_publisher_did, em_min"
" FROM califadr3.cubes"):
em_min = rec["em_min"]
with open("proc.fits", "wb") as f:
f.write(rec.processed(band=(em_min, em_min+1e-10)))
```

This fails with:

```
pyvo.dal.exceptions.DALServiceError: No SODA Resouces available and no dataformat in record. Maybe you forgot to include it into the TAP Query?
```

It wouldn't need to, since a smart datalink client could retrieve a links document (there is a datalink service block on the response) that in this case contains a SODA service.

I'm quite sure we should make pyVO do this; I actually think it used to do that before commit 382b50b0. Thinking for a while about how that broke previous behaviour might be a good idea, but since the previous behaviour was broken in its own way, I'd say we should rather write some new code in dal.adhoc, _get_soda_resource. When the first two attempts fail, it should then use a datalink service block, fetch a links document and then run get_adhocservice_by_ivoid(SODA_SYNC_IVOID) on that; if that doesn't raise a DALServiceError, we'd have a SODA block that ought to work with our id.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported TAP/SODA script and inspect dal.adhoc._get_soda_resource, especially how it handles the datalink service block. Trace fetching the links document and resolving SODA_SYNC_IVOID; the work is done when processed() can retrieve the SODA resource through that external datalink without requiring dataformat in the TAP query.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.