EsaTap#

class astroquery.esa.utils.EsaTap(*, auth_session=None, tap_url=None)[source]#

Bases: BaseVOQuery, BaseQuery

Set the session, alternative TAP url, initial parameter for the TAP connection

Parameters:
auth_sessionpyvo.auth.authsession.AuthSession, optional, default None

Authentication session to manage login

tap_urlstr, optional, default None

In case an alternative URL for the TAP needs to be defined

Returns:
A list of table objects

Attributes Summary

REQUEST_PARAMETERS

THRESHOLD

Class to init ESA TAP Module to communicate with {ESA_ARCHIVE_NAME} Science Archive

TIMEOUT

tap

Initialize {ESA_ARCHIVE_NAME} TAP connection

Methods Summary

create_cone_search_query(ra, dec, ra_column, ...)

get_job(jobid)

Returns the job corresponding to an ID from ISLA TAP.

get_job_list(*[, phases, after, last, ...])

Returns all the asynchronous jobs stored in ISLA TAP.

get_metadata(table)

Gets the specified table from ISLA TAP

get_table(table)

Gets the specified table from ISLA TAP

get_tables(*[, only_names])

Gets all public tables within ISLA TAP

login(*[, user, password])

Performs a login in ISLA TAP.

logout()

Performs a logout in ISLA TAP.

query_table(table_name, *[, columns, ...])

Query a set of columns from a specific table in ISLA TAP, using filters defined by the user

query_tap(query, *[, async_job, ...])

Launches a synchronous or asynchronous job to query the ISLA TAP

Attributes Documentation

REQUEST_PARAMETERS = {}#
THRESHOLD = 1e-05#

Class to init ESA TAP Module to communicate with {ESA_ARCHIVE_NAME} Science Archive

Subclasses must define:

ESA_ARCHIVE_NAME: str TAP_URL: str LOGIN_URL: str LOGOUT_URL: str TIMEOUT (Optional) = 60 REQUEST_PARAMETERS = {} THRESHOLD = 1e-5

TIMEOUT = 60#
tap#

Initialize {ESA_ARCHIVE_NAME} TAP connection

Returns:
A TAPService object connected to {ESA_ARCHIVE_NAME} TAP

Methods Documentation

create_cone_search_query(ra, dec, ra_column, dec_column, radius)[source]#
get_job(jobid)[source]#

Returns the job corresponding to an ID from ISLA TAP. Note that the user must be able to see the job in the current security context.

Parameters:
jobidstr, mandatory

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]#

Returns all the asynchronous jobs stored in ISLA TAP. Note that the user must be able to see the job in the current security context.

Parameters:
phaseslist of str

Union of job phases to filter the results by.

afterdatetime

Return only jobs created after this datetime

lastint

Return only the most recent number of jobs

short_descriptionflag - 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:
A list of Job objects
get_metadata(table)[source]#

Gets the specified table from ISLA TAP

Parameters:
tablestr, mandatory
full qualified table name (i.e. schema name.table name)
Returns:
A table object
get_table(table)[source]#

Gets the specified table from ISLA TAP

Parameters:
tablestr, mandatory

full qualified table name (i.e. schema name + table name)

Returns:
A table object
get_tables(*, only_names=False)[source]#

Gets all public tables within ISLA TAP

Parameters:
only_namesbool, optional, default False

True to load table names only

Returns:
A list of table objects
login(*, user=None, password=None)[source]#

Performs a login in ISLA TAP. TAP+ only User and password shall be used

Parameters:
userstr, mandatory, default None

Username. If no value is provided, a prompt to type it will appear

passwordstr, mandatory, default None

User password. If no value is provided, a prompt to type it will appear

logout()[source]#

Performs a logout in ISLA TAP. TAP+ only

query_table(table_name, *, columns=None, custom_filters=None, get_metadata=False, async_job=False, output_file=None, output_format='votable', **filters)[source]#

Query a set of columns from a specific table in ISLA TAP, using filters defined by the user

Parameters:
table_namestr, mandatory

name of the table where this query will be executed

columnslist of str or str, optional, default ‘None’

columns from the table to be retrieved

custom_filtersstr, optional, default ‘None’

No SQL filters defined by the user E.g. ADQL Intersect filter

get_metadata: bool, optional, default False

If set to true, the method will return an astropy.Table containing the available columns for this table, including the description, units, ucd, utype and data type

async_jobbool, optional, default ‘False’

executes the query (job) in asynchronous/synchronous mode (default synchronous)

output_filestr, optional, default None

file name where the results are saved

output_formatstr, optional, default ‘votable’

results format

Users can defined more parameters, using the column names. They will be
used to generate the SQL filters for the query. Some examples are described below,
where the left side is the parameter defined for this method and the right side the
SQL filter generated:
StarName=’star1’ -> StarName = ‘star1’
StarName=’star*’ -> StarName ILIKE ‘star%’
StarName=’star%’ -> StarName ILIKE ‘star%’
StarName=[‘star1’, ‘star2’] -> StarName = ‘star1’ OR StarName - ‘star2’
ra=(‘>’, 30) -> ra > 30
ra=(20, 30) -> ra >= 20 AND ra <= 30
Returns:
An astropy.table object containing the results
query_tap(query, *, async_job=False, output_file=None, output_format='votable', verbose=False)[source]#

Launches a synchronous or asynchronous job to query the ISLA TAP

Parameters:
querystr, mandatory

query (adql) to be executed

async_jobbool, optional, default ‘False’

executes the query (job) in asynchronous/synchronous mode (default synchronous)

output_filestr, optional, default None

file name where the results are saved. If this parameter is not provided

output_formatstr, optional, default ‘votable’

results format

verbose: bool, optional, default False

To log the query when executing this method.

Returns:
An astropy.table object containing the results