Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: add support for TAP's FORMAT parameter #524

Open
bsipocz opened this issue Feb 2, 2024 · 1 comment
Open

ENH: add support for TAP's FORMAT parameter #524

bsipocz opened this issue Feb 2, 2024 · 1 comment

Comments

@bsipocz
Copy link
Member

bsipocz commented Feb 2, 2024

Original motivation:
This has been moved over from astroquery as I was running into pyvo limitations while I tried to address this problem. The issue I tried to address is to run a caom query to list all the possible collection values for an SIA query. The query, leaving the default return format, is expected to take long, but we do have some formats cached on server side (ipac table, HTML, and json at the time it came up). So the easy solution would have been to pass on the FORMAT keyword.

However, the pyvo machinery is not at all prepared for that, even though we have e.g. execute_raw() method to compliment execute_votable(), the mixin inheritances later on still assume to receive votables.

(e.g. TAPResults is eventually inherited from AdhocServiceResultsMixin that assumes votable inputs, etc. At that point I stopped investigating further and will ask on our server side to keep caching the default votable result, too.

However, I think it would be nice to eventually support other formats, even if it only means dumping the text stream back to the user without doing any parsing of it. (That was my intention before running into this multi-generation inheritance)

query = "SELECT DISTINCT collection from caom.observation ORDER by collection"
format = 'IPAC_TABLE'
result = Irsa.query_tap(query=query, format=format)
Traceback (most recent call last):
  File "/Users/bsipocz/.pyenv/versions/3.11.0/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3433, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-7-141065291541>", line 3, in <module>
    result = Irsa.query_tap(query=query, format=format)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bsipocz/munka/devel/astroquery/astroquery/ipac/irsa/core.py", line 85, in query_tap
    return self.tap.search(query, language='ADQL', format=format, maxrec=maxrec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bsipocz/munka/devel/pyvo/pyvo/dal/tap.py", line 278, in run_sync
    **keywords).execute()
                ^^^^^^^^^
  File "/Users/bsipocz/munka/devel/pyvo/pyvo/dal/tap.py", line 1117, in execute
    return TAPResults(self.execute_raw(), url=self.queryurl, session=self._session)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bsipocz/munka/devel/pyvo/pyvo/dal/adhoc.py", line 111, in __init__
    super().__init__(votable, url=url, session=session)
  File "/Users/bsipocz/munka/devel/pyvo/pyvo/dal/query.py", line 334, in __init__
    self._status = self._findstatus(votable)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bsipocz/munka/devel/pyvo/pyvo/dal/query.py", line 376, in _findstatus
    res = self._findresultsresource(votable)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bsipocz/munka/devel/pyvo/pyvo/dal/query.py", line 365, in _findresultsresource
    if len(votable.resources) < 1:
           ^^^^^^^^^^^^^^^^^
AttributeError: 'TAPQuery' object has no attribute 'resources'

See here:
https://irsa.ipac.caltech.edu/docs/program_interface/TAP.html

(this will be needed to address astropy/astroquery#2940 )

@bsipocz
Copy link
Member Author

bsipocz commented Feb 2, 2024

This may need to be propagated upstream into pyvo as irsa_tap.search(query, language='ADQL', format='html') triggers a DALFormatError: E19: None:2:0: E19: File does not appear to be a VOTABLE

@bsipocz bsipocz transferred this issue from astropy/astroquery Feb 15, 2024
@bsipocz bsipocz changed the title ENH: add support for IRSA TAP's FORMAT parameter ENH: add support for TAP's FORMAT parameter Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant