TAPQuery

class pyvo.dal.TAPQuery(baseurl, query, mode='sync', language='ADQL', maxrec=None, uploads=None, session=None, **keywords)[source]

Bases: DALQuery

a class for preparing an query to an TAP service. Query constraints are added via its service type-specific methods. The various execute() functions will submit the query and return the results.

The base URL for the query, which controls where the query will be sent when one of the execute functions is called, is typically set at construction time; however, it can be updated later via the baseurl to send a configured query to another service.

In addition to the search constraint attributes described below, search parameters can be set generically by name via dict semantics.

The typical function for submitting the query is execute(); however, alternate execute functions provide the response in different forms, allowing the caller to take greater control of the result processing.

initialize the query object with the given parameters

Parameters
baseurlstr

the TAP baseurl

querystr

the query string

modestr

the query mode (sync | async). default “sync”

languagestr

the query language. defaults to ADQL

maxrecint

the amount of records to fetch

uploadsdict

Files to upload. Uses table name as key and table content as value.

sessionobject

optional session to use for network requests

Attributes Summary

queryurl

the URL to which to submit queries

Methods Summary

execute()

submit the query and return the results as a TAPResults instance

execute_stream([post])

submit the query and return the raw VOTable XML as a file stream

submit([post])

Does the request part of the TAP query.

Attributes Documentation

queryurl

the URL to which to submit queries

In TAP, that varies depending on whether we run sync or async queries.

Methods Documentation

execute()[source]

submit the query and return the results as a TAPResults instance

Raises
DALServiceError

for errors connecting to or communicating with the service

DALQueryError

for errors either in the input query syntax or other user errors detected by the service

DALFormatError

for errors parsing the VOTable response

execute_stream(post=False)[source]

submit the query and return the raw VOTable XML as a file stream

Raises
DALServiceError

for errors connecting to or communicating with the service

DALQueryError

for errors in the input query syntax

submit(post=False)[source]

Does the request part of the TAP query. This function is separated from response parsing because async queries return no votable but behave like sync queries in terms of request. It returns the requests response.