TAPService¶
- class pyvo.dal.TAPService(baseurl, *, capability_description=None, session=None)[source]¶
Bases:
DALService
,AvailabilityMixin
,CapabilityMixin
a representation of a Table Access Protocol service
instantiate a Table Access Protocol service
- Parameters:
- baseurlstr
the base URL that should be used for forming queries to the service.
- sessionobject
optional session to use for network requests
Attributes Summary
returns examples as a list of TAPQuery objects
the hard output limit.
the default output limit.
returns tables as a dict-like object
a list of upload methods in form of
UploadMethod
objectsMethods Summary
create_index
(table_name, column_name, *[, ...])Creates a table index in the catalog service.
create_query
([query, mode, language, ...])create a query object that constraints can be added to and then executed.
create_table
(name, definition, *[, format])Creates a table in the catalog service.
describe
([width])Print a summary description of this service.
get_job
(job_id)Returns the job corresponding to an ID.
get_job_list
(*[, phases, after, last, ...])lists jobs that the caller can see in the current security context.
load_table
(name, source, *[, format])Loads content to a table
remove_table
(name)Remove a table from the catalog service (Equivalent to drop command in DB).
run_async
(query, *[, language, maxrec, uploads])runs async query and returns its result
run_sync
(query, *[, language, maxrec, uploads])runs sync query and returns its result
search
(query, *[, language, maxrec, uploads])runs sync query and returns its result
submit_job
(query, *[, language, maxrec, uploads])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_index(table_name, column_name, *, unique=False)[source]¶
Creates a table index in the catalog service.
- Parameters:
- table_name: str
Name of the table
- column_name: str
Name of the column in the table
- unique: bool
True for unique index, False otherwise
- create_query(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:
- baseurlstr
the base URL for the TAP service
- querystr
the query string / parameters
- modestr
the query mode (sync | async). default “sync”
- languagestr
specifies the query language, default ADQL. useful for services which allow to use the backend query language.
- maxrecint
specifies the maximum records to return. defaults to the service default.
- uploadsdict
a mapping from table names to objects containing a votable.
- create_table(name, definition, *, format='VOSITable')[source]¶
Creates a table in the catalog service.
- Parameters:
- name: str
Name of the table in the TAP service
- definition: stream (object with a read method)
Definition of the table
- format: str
Format of the table definition (VOSITable or VOTable).
- describe(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(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_idstr
ID of the job to view
- Returns:
JobSummary
corresponding to the job ID
- get_job_list(*, 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
- list of
- load_table(name, source, *, format='tsv')[source]¶
Loads content to a table
- Parameters:
- name: str
Name of the table
- source: stream with a read method
Stream containing the data to be loaded
- format: str
Format of the data source: tab-separated values(tsv), comma-separated values (csv) or FITS table (FITSTable)
- remove_table(name)[source]¶
Remove a table from the catalog service (Equivalent to drop command in DB).
- Parameters:
- name: str
Name of the table in the TAP service
- run_async(query, *, language='ADQL', maxrec=None, uploads=None, **keywords)[source]¶
runs async query and returns its result
- Parameters:
- querystr, dict
the query string / parameters
- languagestr
specifies the query language, default ADQL. useful for services which allow to use the backend query language.
- maxrecint
the maximum records to return. defaults to the service default
- uploadsdict
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
- run_sync(query, *, language='ADQL', maxrec=None, uploads=None, **keywords)[source]¶
runs sync query and returns its result
- Parameters:
- querystr
The query
- languagestr
specifies the query language, default ADQL. useful for services which allow to use the backend query language.
- maxrecint
the maximum records to return. defaults to the service default
- uploadsdict
a mapping from table names to objects containing a votable
- Returns:
- TAPResults
the query result
See also
- search(query, *, language='ADQL', maxrec=None, uploads=None, **keywords)¶
runs sync query and returns its result
- Parameters:
- querystr
The query
- languagestr
specifies the query language, default ADQL. useful for services which allow to use the backend query language.
- maxrecint
the maximum records to return. defaults to the service default
- uploadsdict
a mapping from table names to objects containing a votable
- Returns:
- TAPResults
the query result
See also
- submit_job(query, *, language='ADQL', maxrec=None, uploads=None, **keywords)[source]¶
submit a async query without starting it and returns a AsyncTAPJob object
- Parameters:
- querystr
the query string / parameters
- languagestr
specifies the query language, default ADQL. useful for services which allow to use the backend query language.
- maxrecint
the maximum records to return. defaults to the service default
- uploadsdict
a mapping from table names to objects containing a votable
- Returns:
- AsyncTAPJob
the query instance
See also