The Table Access Protocol (TAP) was developed by IVOA is a second generation DAL interface being developed to provide a general access mechanism for tabular data, including but not limited to astronomical catalogs.
The URL for Gaia@AIP’s TAP service is:
There are numerous ways to use TAP that are explained below.
You can find the full TAP documentation on the IVOA documentation website.
How to use TAP in Python
Daiquiri TAP is a tiny wrapper for astroquery.utils.tap, adding support for token authorization.
To set it up, you’ll need to pip install is:
pip install git+https://github.com/aipescience/django-daiquiri-tap
It is used like Astroquery, which is extensively documented in the Astroquery documentation, but allows to set a token for authorized access to your user account.
The token can be accessed under the url /accounts/token/ of the particular Gaia@AIP site. You’ll need to replace the example token with the token from gaia.aip.de/accounts/token/.
This is how your code will look in Python:
from daiquiri_tap import DaiquiriTap TOKEN = '91123cc8db1bb44326b4d820f88c54bbdec4bea0' service = DaiquiriTap(url='https://gaia.aip.de/tap', token=TOKEN) job = service.launch_job('select top 10 ra, dec from gdr1.tgas_source') print(job) r = job.get_results() print(r['ra'])
How to use TAP with TOPCAT
Topcat is a Tool for OPerations on Catalogues And Tables.
To use TAP in Gaia@AIP in Topcat, you’ll need to select Gaia@AIP as the service provider in Topcat:
Now you can select the table:
Here you'll find a documentation how to use TAP in Topcat:
How to use TAP on the command line
TAP can also be used with a HTTP command line client. Here we use HTTPie, but there are a lot of other similar clients (e.g. curl).
# retrieve the job list http https://gaia.aip.de/tap/async # submit an asyncronous job (using PostgreSQL and the 5 minutes queue) http -f --follow POST https://gaia.aip.de/tap/async \ QUERY="SELECT ra, dec FROM gdr2.gaia_source WHERE random_index < 100" \ LANG="postgresql-9.6" QUEUE="5m" PHASE="RUN" # get all the information about a job http https://gaia.aip.de/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b # check the status of a job http https://gaia.aip.de/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b/phase # get the results of a job as csv or votable http https://gaia.aip.de/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b/results/csv http https://gaia.aip.de/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b/results/votable # archive the job (this deletes the database table and frees up space) http --follow DELETE https://gaia.aip.de/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b
As with the Python interface, you can also use your personal token to authenticate with the system to use your personal account (and your personal joblist, quota etc.). To do so, you need to send the token as part of the
Authorization header with every HTTP request.
http https://gaia.aip.de/tap/async Authorization:"Token c1a67d3db8b1c93e55573aa1a8a2133a5e65c301"