TAPService

class pyvo.dal.TAPService(baseurl, session=None)[source]

Bases: pyvo.dal.DALService, pyvo.dal.vosi.AvailabilityMixin, pyvo.dal.vosi.CapabilityMixin

a representation of a Table Access Protocol service

instantiate a Tablee Access Protocol service

Parameters:
baseurl : str

the base URL that should be used for forming queries to the service.

session : object

optional session to use for network requests

Attributes Summary

examples returns examples as a list of TAPQuery objects
hardlimit the hard output limit.
maxrec the default output limit.
tables returns tables as a dict-like object
upload_methods a list of upload methods in form of UploadMethod objects

Methods Summary

create_query(self[, query, mode, language, …]) create a query object that constraints can be added to and then executed.
describe(self[, width]) Print a summary description of this service.
get_job(self, job_id) Returns the job corresponding to an ID.
get_job_list(self[, phases, after, last, …]) lists jobs that the caller can see in the current security context.
run_async(self, query[, language, maxrec, …]) runs async query and returns its result
run_sync(self, query[, language, maxrec, …]) runs sync query and returns its result
search(self, query[, language, maxrec, uploads]) runs sync query and returns its result
submit_job(self, query[, language, maxrec, …]) submit a async query without starting it and returns a AsyncTAPJob object

Attributes Documentation

examples

returns examples as a list of TAPQuery objects

hardlimit

the hard output limit.

Raises:
DALServiceError

if the property is not exposed by the service

maxrec

the default output limit.

Raises:
DALServiceError

if the property is not exposed by the service

tables

returns tables as a dict-like object

upload_methods

a list of upload methods in form of UploadMethod objects

Methods Documentation

create_query(self, query=None, mode='sync', language='ADQL', maxrec=None, uploads=None, **keywords)[source]

create a query object that constraints can be added to and then executed. The input arguments will initialize the query with the given values.

Parameters:
baseurl : str

the base URL for the TAP service

query : str

the query string / parameters

mode : str

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

language : str

specifies the query language, default ADQL. useful for services which allow to use the backend query language.

maxrec : int

specifies the maximum records to return. defaults to the service default.

uploads : dict

a mapping from table names to objects containing a votable.

describe(self, width=None)[source]

Print a summary description of this service.

This includes the interface capabilities, and the content description if it doesn’t contains multiple data collections (in other words, it is not a TAP service).

get_job(self, job_id)[source]

Returns the job corresponding to an ID. Note that the caller must be able to see the job in the current security context.

Parameters:
job_id : str

ID of the job to view

Returns:
JobSummary corresponding to the job ID
get_job_list(self, phases=None, after=None, last=None, short_description=True)[source]

lists jobs that the caller can see in the current security context. The list can be filtered on the server side by the phases of the jobs, creation date time or Note that by default jobs in ‘ARCHIVED` phase are not returned.

Parameters:
phases: list of str

Union of job phases to filter the results by.

after: datetime

Return only jobs created after this datetime

last: int

Return only the most recent number of jobs

short_description: flag - True or False

If True, the jobs in the list will contain only the information corresponding to the TAP ShortJobDescription object (job ID, phase, run ID, owner ID and creation ID) whereas if False, a separate GET call to each job is performed for the complete job description.

Returns:
list of JobSummary
run_async(self, query, language='ADQL', maxrec=None, uploads=None, **keywords)[source]

runs async query and returns its result

Parameters:
query : str, dict

the query string / parameters

language : str

specifies the query language, default ADQL. useful for services which allow to use the backend query language.

maxrec : int

the maximum records to return. defaults to the service default

uploads : dict

a mapping from table names to objects containing a votable

Returns:
TAPResult

the query 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

See also

AsyncTAPJob
run_sync(self, query, language='ADQL', maxrec=None, uploads=None, **keywords)[source]

runs sync query and returns its result

Parameters:
query : str

The query

language : str

specifies the query language, default ADQL. useful for services which allow to use the backend query language.

maxrec : int

the maximum records to return. defaults to the service default

uploads : dict

a mapping from table names to objects containing a votable

Returns:
TAPResults

the query result

See also

TAPResults
search(self, query, language='ADQL', maxrec=None, uploads=None, **keywords)

runs sync query and returns its result

Parameters:
query : str

The query

language : str

specifies the query language, default ADQL. useful for services which allow to use the backend query language.

maxrec : int

the maximum records to return. defaults to the service default

uploads : dict

a mapping from table names to objects containing a votable

Returns:
TAPResults

the query result

See also

TAPResults
submit_job(self, query, language='ADQL', maxrec=None, uploads=None, **keywords)[source]

submit a async query without starting it and returns a AsyncTAPJob object

Parameters:
query : str

the query string / parameters

language : str

specifies the query language, default ADQL. useful for services which allow to use the backend query language.

maxrec : int

the maximum records to return. defaults to the service default

uploads : dict

a mapping from table names to objects containing a votable

Returns:
AsyncTAPJob

the query instance

See also

AsyncTAPJob