Simple Join Service
The Simple Join Service uses source IDs from your query results to download data from selected Gaia DR3 and DR2 tables, including spectra and epoch photometry. Each request can use up to 5,000 source IDs. You can also query the supported tables through TAP.
Use the Query interface
Run a query that returns a column with source IDs from the release you want to join. Open the Download tab of the completed job and find the Simple Join Service (DR3/DR2) card.
- Under Column name, select the column containing the source IDs, such as
source_id. - Under Join table, select the table you want to download data from.
- Choose an available Response format, such as VOTable or ECSV.
- Under Data structure, choose COMBINED for one file with all matched sources or INDIVIDUAL for one file per source.
- Click Create file and download the output when it is ready.
Supported tables
gaiadr3.xp_sampled_mean_spectrumgaiadr3.rvs_mean_spectrumgaiadr3.xp_continuous_mean_spectrumgaiadr3.epoch_photometrygaiadr3.mcmc_samples_mscgaiadr3.mcmc_samples_gsp_photgaiadr2.epoch_photometry
Scripted access
This example selects up to ten Gaia DR3 sources with epoch photometry. It passes the TAP job ID to the Simple Join Service, then saves a ZIP archive with one ECSV file per source. Replace <your-token> with your Gaia@AIP API token. Python requirements and API token setup
from io import BytesIO
import pyvo
import requests
URL_TAP = "https://gaia.aip.de/tap"
URL_UWS = "https://gaia.aip.de/uws/simple-join-service"
TOKEN = "<your-token>"
OUTPUT_FILE = "gaia-dr3-epoch-photometry.zip"
session = requests.Session()
session.headers["Authorization"] = f"Token {TOKEN}"
# Select sources with epoch photometry.
tap_service = pyvo.dal.TAPService(URL_TAP, session=session)
query = """
SELECT TOP 10 source_id
FROM gaiadr3.gaia_source_lite
WHERE has_epoch_photometry = 'true'
"""
tap_job = tap_service.submit_job(query)
tap_job.run()
tap_job.wait()
tap_job.raise_if_error()
# Submit the Simple Join Service job using the TAP result table.
response = session.post(
URL_UWS,
data={
"JOB_ID": tap_job.job_id,
"COLUMN_NAME": "source_id",
"JOIN_TABLE": "gaiadr3.epoch_photometry",
"RESPONSEFORMAT": "ecsv",
"DATA_STRUCTURE": "INDIVIDUAL",
},
)
response.raise_for_status()
join_job_id = pyvo.io.uws.parse_job(BytesIO(response.content)).jobid
join_job = pyvo.dal.AsyncTAPJob(f"{URL_UWS}/{join_job_id}", session=session)
join_job.run()
join_job.wait()
join_job.raise_if_error()
# Save the ZIP archive once the join job finishes.
with session.get(join_job.results[0].href, stream=True) as response:
response.raise_for_status()
with open(OUTPUT_FILE, "wb") as file:
for chunk in response.iter_content(chunk_size=65536):
file.write(chunk)
print(f"Saved {OUTPUT_FILE}")
# Archive both jobs after saving the result.
join_job.delete()
tap_job.delete()
The example above uses PyVO’s AsyncTAPJob as a convenient wrapper for the Simple Join Service job. This works because the Gaia@AIP UWS endpoint follows the same conventions as asynchronous TAP jobs for starting a job, checking its phase, and accessing its result URL.
Direct UWS example
This example submits the initial query through TAP, then sends HTTP requests directly to the Simple Join Service. pyvo.io.uws.parse_job() reads the job ID, phase, and result link from the UWS responses.
from io import BytesIO
from time import sleep
import pyvo
import requests
from pyvo.io.uws import parse_job
URL_TAP = "https://gaia.aip.de/tap"
URL_UWS = "https://gaia.aip.de/uws/simple-join-service"
TOKEN = "<your-token>"
OUTPUT_FILE = "gaia-dr3-epoch-photometry-uws.zip"
session = requests.Session()
session.headers["Authorization"] = f"Token {TOKEN}"
# Select sources with epoch photometry.
tap_service = pyvo.dal.TAPService(URL_TAP, session=session)
query = """
SELECT TOP 10 source_id
FROM gaiadr3.gaia_source_lite
WHERE has_epoch_photometry = 'true'
"""
tap_job = tap_service.submit_job(query)
tap_job.run()
tap_job.wait()
tap_job.raise_if_error()
# Create the Simple Join Service job and start it.
response = session.post(
URL_UWS,
data={
"JOB_ID": tap_job.job_id,
"COLUMN_NAME": "source_id",
"JOIN_TABLE": "gaiadr3.epoch_photometry",
"RESPONSEFORMAT": "ecsv",
"DATA_STRUCTURE": "INDIVIDUAL",
},
)
response.raise_for_status()
job = parse_job(BytesIO(response.content))
job_url = f"{URL_UWS}/{job.jobid}"
response = session.post(f"{job_url}/phase", data={"PHASE": "RUN"})
response.raise_for_status()
# Read the job description until the job finishes.
while True:
response = session.get(job_url)
response.raise_for_status()
job = parse_job(BytesIO(response.content))
if job.phase == "COMPLETED":
break
if job.phase not in {"PENDING", "QUEUED", "EXECUTING"}:
raise RuntimeError(f"Simple Join Service job is in phase {job.phase} ({job_url})")
sleep(2)
# Download the ZIP archive using the result link from the completed job.
with session.get(job.results[0].href, stream=True) as response:
response.raise_for_status()
with open(OUTPUT_FILE, "wb") as file:
for chunk in response.iter_content(chunk_size=65536):
file.write(chunk)
print(f"Saved {OUTPUT_FILE}")
# Archive both jobs after saving the result.
response = session.delete(job_url)
response.raise_for_status()
tap_job.delete()