TAPQuery

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

Bases: pyvo.dal.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:
baseurl : str

the TAP baseurl

query : str

the query string

mode : str

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

language : str

the query language. defaults to ADQL

maxrec : int

the amount of records to fetch

uploads : dict

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

session : object

optional session to use for network requests

Attributes Summary

queryurl The URL that encodes the current query.

Methods Summary

execute(self) submit the query and return the results as a TAPResults instance
execute_stream(self[, post]) submit the query and return the raw VOTable XML as a file stream
submit(self[, post]) Does the request part of the TAP query.

Attributes Documentation

queryurl

The URL that encodes the current query. This is the URL that the execute functions will use if called next.

Methods Documentation

execute(self)[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(self, 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(self, 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.