How can I query external TAP services?

Hi team, how could one define an external TAP service URL, and query for data there?

I was hoping that the get_tap_service() method from rubin_jupyter_utils.lab.notebook method would accept an argument to define a TAP URL, but it does not appear to be the case. Is there another way?

Thank you,
Robert

1 Like

Ah, that function uses pyvo.dal.TAPService() under the hood. So, this works for instance:

import pyvo
tap = pyvo.dal.TAPService('https://datalab.noirlab.edu/tap')
tap.run_sync('select count(*) from gaia_edr3.gaia_source')

<Table length=1>
  COUNT   
  int32   
----------
1811709771

Thank you.

1 Like

Hi Robert
I’m trying to run the 01_Intro_to_DP0_Notebooks jupyter notebook.
Can you advise where you downloaded and pip-installed the rubin_jupyter_utils.lab.notebook module.
I found one, however, while the import seems to work, the service = get_tap_service() seems to go nowhere.

Hi @fsklich,
Although you can pip install (probably you found this?), the DP0 notebooks will only work when run in the Rubin Science Platform. I’m really sorry this was unclear, and have added an explicit statement to the tutorial-notebooks repository’s README file.
Melissa

1 Like

It’s not unclear. Two days ago, I did see the intro notebook explicitly stated “Target audience: All DP0 delegates…” .

To expand on Melissa’s entirely correct answer: The RSP Notebook Aspect is a service based on JupyterLab, however the environment is heavily customized to provide convenience features to Rubin users and to support and improve service quality. This is why it is not a requirement for our notebooks to run in a stock ipython environment, and frequently they will not. get_tap_service()is an example of such a convenience function we provide to RSP users since depending on which particular deployment you are using, the TAP service you should address is different, but we want the same notebook to work on all our RSP deployments without modification.

That said, as @rnikutta discovered, you can address any TAP service you like using standard TAP libraries such as pyvo.