More informative error message for table upload
- Dominant language
- Python
- Stars
- 88
- Forks
- 64
- Avg merge
- 38m
- Merged PRs (30d)
- 1
Description
The file intended for upload doesn't exist, but the error message is a bit cryptic, I would find a more standard `FileNotFoundError` more useful in this case. I think addressing it belongs to pyvo, but let me know if you rather move this back to astroquery.
```
>>> from astroquery.cadc import Cadc
>>> cadc = Cadc()
>>> # save a few observations on a local file
>>> results = cadc.exec_sync("SELECT TOP 3 observationID FROM caom2.Observation",
... output_file='my_observations.xml')
>>> print(results)
observationID
----------------------------------
c13a_060826_044314_ori
tess2021167190903-s0039-1-3-0210-s
tu1657207
>>> # now use them to join with the remote table
>>> results = cadc.exec_sync("SELECT o.observationID, intent FROM caom2.Observation o "
... "JOIN tap_upload.test_upload tu ON o.observationID=tu.observationID",
... uploads={'test_upload': 'my_datasets.xml'})
---------------------------------------------------------------------------
DALQueryError Traceback (most recent call last)
in
1 # now use them to join with the remote table
----> 2 results = cadc.exec_sync("SELECT o.observationID, intent FROM caom2.Observation o "
3 "JOIN tap_upload.test_upload tu ON o.observationID=tu.observationID",
4 uploads={'test_upload': 'my_datasets.xml'})
~/munka/devel/astroquery/astroquery/cadc/core.py in exec_sync(self, query, maxrec, uploads, output_file, output_format)
633 as they are available in pyvo.
634 """
--> 635 response = self.cadctap.search(query, language='ADQL',
636 uploads=uploads)
637 result = response.to_table()
~/.pyenv/versions/3.9.1/lib/python3.9/site-packages/pyvo/dal/tap.py in run_sync(self, query, language, maxrec, uploads, **keywords)
244 TAPResults
245 """
--> 246 return self.create_query(
247 query, language=language, maxrec=maxrec, uploads=uploads,
248 **keywords).execute()
~/.pyenv/versions/3.9.1/lib/python3.9/site-packages/pyvo/dal/tap.py in execute(self)
940 for errors parsing the VOTable response
941 """
--> 942 return TAPResults(self.execute_votable(), url=self.queryurl, session=self._session)
943
944 def submit(self, post=False):
~/.pyenv/versions/3.9.1/lib/python3.9/site-packages/pyvo/dal/adhoc.py in __init__(self, votable, url, session)
109 """
110 def __init__(self, votable, url=None, session=None):
--> 111 super().__init__(votable, url=url, session=session)
112
113 self._adhocservices = list(
~/.pyenv/versions/3.9.1/lib/python3.9/site-packages/pyvo/dal/query.py in __init__(self, votable, url, session)
318 self._status = self._findstatus(votable)
319 if self._status[0].lower() not in ("ok", "overflow"):
--> 320 raise DALQueryError(self._status[1], self._status[0], url)
321
322 self._resultstable = self._findresultstable(votable)
DALQueryError: URI is not absolute
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the upload handling reached through pyvo/dal/tap.py's run_sync and create_query flow, using the traceback and the missing my_datasets.xml example as the reproduction. Verify the behavior when the upload path does not exist, and consider the issue complete when that case raises a standard FileNotFoundError instead of the cryptic DALQueryError shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100