Using the nexsciTAP Server with the TAP+ Client to Access Data From KOA In Asynchronous Mode

The nexsciTAP server

The NASA Exoplanet Science Institute (NExScI) (visit https://nexsci.caltech.edu) has developed a Python-based server to implement an API that complies with the Virtual Observatory (VO) Table Access Protocol(TAP) version 1.1 (September 2019) (http://ivoa.net/documents/TAP/20190927/index.html), a standard recommended by the International Virtual Observatory alliance (IVOA) (http://ivoa.net).

The TAP API enables a rich variety of searches against tabular data, includung cone, box or all-sky searches, temporal searches, combinations of spatial searches and temporal searches, searches against instrumental attributes and program attributes.

This tutorial supports demonstrates how to use the TAP+ client to perform synchronous TAP-based queries for public raw science and calibration data acquired with the Echellette Spectrograph and Imager (ESI); these data are hosted at the Keck Observatory Archive (KOA; https://koa.ipac.caltech.edu).

Requirements

TAP+ was developed at the ESAC Space Data Centre (ESDC: http://www.cosmos.esa.int/web/esdc/) and can be installed from PyPI as part of the astroquery package:

$ pip install --upgrade astroquery

The tutorial requires Python 3.6 (or above), plus the table read and write functions from Astropy. We have tested with Astropy 4.0.1, but any version should work. We recommend using the Ananconda Python distribution.

A note on output records

The number of records returned here may differ from those returned here because new data are released daily.

Version 1.0 (March, 2021)

In [2]:
import numpy as np
from astroquery.utils.tap.core import TapPlus
koa = TapPlus(url="https://koa.ipac.caltech.edu/TAP")
Created TAP+ (v1.2.1) - Connection:
	Host: koa.ipac.caltech.edu
	Use HTTPS: True
	Port: 443
	SSL Port: 443

Search by date

In [3]:
sql = "select koaid, filehand from koa_esi where koaid like '%20150902%' "
job = koa.launch_job_async(sql)
r = job.get_results()
print(r)
print(job)
INFO: Query finished. [astroquery.utils.tap.core]
        koaid                                filehand                     
---------------------- ---------------------------------------------------
ES.20150902.10478.fits /koadata36/ESI/20150902/lev0/ES.20150902.10478.fits
ES.20150902.10550.fits /koadata36/ESI/20150902/lev0/ES.20150902.10550.fits
ES.20150902.45958.fits /koadata36/ESI/20150902/lev0/ES.20150902.45958.fits
ES.20150902.46025.fits /koadata36/ESI/20150902/lev0/ES.20150902.46025.fits
ES.20150902.46101.fits /koadata36/ESI/20150902/lev0/ES.20150902.46101.fits
ES.20150902.46168.fits /koadata36/ESI/20150902/lev0/ES.20150902.46168.fits
ES.20150902.46410.fits /koadata36/ESI/20150902/lev0/ES.20150902.46410.fits
ES.20150902.85368.fits /koadata36/ESI/20150903/lev0/ES.20150902.85368.fits
ES.20150902.85427.fits /koadata36/ESI/20150903/lev0/ES.20150902.85427.fits
ES.20150902.85487.fits /koadata36/ESI/20150903/lev0/ES.20150902.85487.fits
ES.20150902.85546.fits /koadata36/ESI/20150903/lev0/ES.20150902.85546.fits
ES.20150902.85605.fits /koadata36/ESI/20150903/lev0/ES.20150902.85605.fits
ES.20150902.85664.fits /koadata36/ESI/20150903/lev0/ES.20150902.85664.fits
<Table length=13>
  name   dtype 
-------- ------
   koaid object
filehand object
Jobid: tap_94dhb5ye
Phase: COMPLETED
Owner: None
Output file: async_20210303142729.vot
Results: None

Write the output to the IPAC ASCII, VOtable CSV and TSV formats

In [4]:
job = koa.launch_job_async(sql, dump_to_file=True, output_file='KoaTapDate.tbl', \
                           output_format='ipac')
job = koa.launch_job_async(sql, dump_to_file=True, output_file='KoaTapDate2.vot', 
                           output_format='votable') 
job = koa.launch_job_async(sql, dump_to_file=True, output_file='KoaTapDate3.csv', \
                           output_format='csv')
job = koa.launch_job_async(sql, dump_to_file=True, output_file='KoaTapDate4.tsv', \
                           output_format='tsv')

Select all keywords for data acquired on UT Date

In [5]:
sql = "select * from koa_esi where koaid like '%20150902%'"
job = koa.launch_job_async(sql)
r = job.get_results()
print(r)
print(job)

job = koa.launch_job_async(sql, dump_to_file=True, output_file='AllFields.tbl', \
                           output_format='ipac')
INFO: Query finished. [astroquery.utils.tap.core]
        koaid                ofname      filesize_mb ...    z      spt_ind 
---------------------- ----------------- ----------- ... -------- ---------
ES.20150902.10478.fits e150902_0001.fits          -- ... 0.707107 233211302
ES.20150902.10550.fits e150902_0002.fits          -- ... 0.707107 233211302
ES.20150902.45958.fits e150902_0003.fits          -- ... 0.707107 233211302
ES.20150902.46025.fits e150902_0004.fits          -- ... 0.707107 233211302
ES.20150902.46101.fits e150902_0005.fits          -- ... 0.707107 233211302
ES.20150902.46168.fits e150902_0006.fits          -- ... 0.707107 233211302
ES.20150902.46410.fits e150902_0007.fits          -- ... 0.707107 233211302
ES.20150902.85368.fits e150903_0001.fits          -- ... 0.710322 223311221
ES.20150902.85427.fits e150903_0002.fits          -- ... 0.710322 223311221
ES.20150902.85487.fits e150903_0003.fits          -- ... 0.710322 223311221
ES.20150902.85546.fits e150903_0004.fits          -- ... 0.710322 223311221
ES.20150902.85605.fits e150903_0005.fits          -- ... 0.710322 223311221
ES.20150902.85664.fits e150903_0006.fits          -- ... 0.710322 223311221
<Table length=13>
    name     dtype  n_bad
----------- ------- -----
      koaid  object     0
     ofname  object     0
filesize_mb float64    13
     progid  object     0
   proginst  object     0
     progpi  object     0
   progtitl  object     0
   koaimtyp  object     0
     camera  object     0
   datlevel   int32     0
    obsmode  object     0
   dispscal float64     0
   dqa_date  object     0
   dqa_vers  object     0
     filter  object     0
   guidfwhm float64     6
   guidtime  object     0
    imagemd float64     0
    imagemn float64     0
    imagesd float64     0
    npixsat   int32     0
         oa  object     0
    propint   int32     0
   semester  object     0
    slitlen float64     6
   slitwidt float64     6
   spatscal float64     0
    specres float64     6
   waveblue   int32     6
   wavecntr   int32     6
    wavered   int32     6
   wxdomhum float64     6
   wxdomtmp float64     6
     wxdwpt float64     6
   wxouthum float64     6
   wxouttmp float64     6
    wxpress float64     6
     wxtime  object     0
    wxwndir float64     6
    wxwndsp float64     6
        utc  object     0
    airmass float64     0
   airpress  object     0
   airpwpsi float64     0
    amplist  object     0
   apmskcal  object     0
   apmskerr   int32     0
   apmsknam  object     0
   apmskord   int32     0
   apmskraw   int32     0
   apmsksta  object     0
   apmsktor float64     0
   autoshut  object     0
    axestat  object     0
         az float64     0
    binning  object     0
     bitpix   int32     0
     bscale   int32     0
      bzero   int32     0
    ccdgain  object     0
   ccdpsize  object     0
   ccdspeed  object     0
   coll1raw   int32     0
   coll1cal  object     0
   coll1err   int32     0
   coll1fop  object     0
   coll1sta  object     0
   coll1tor float64     0
   coll2cal  object     0
   coll2err   int32     0
   coll2fop  object     0
   coll2raw   int32     0
   coll2sta  object     0
   coll2tor float64     0
   coll3cal  object     0
   coll3err   int32     0
   coll3fop  object     0
   coll3raw   int32     0
   coll3sta  object     0
   coll3tor float64     0
   collflx1   int32     0
   collflx2   int32     0
   collflx3   int32     0
    collfoc float64     0
   collfocr   int32     0
   collfoct   int32     0
   collmode  object     0
   colloff1   int32     0
   colloff2   int32     0
   colloff3   int32     0
   collstat  object     0
   collusr1   int32     0
   collusr2   int32     0
   collusr3   int32     0
   ctrlfan0  object     0
   ctrlfan1  object     0
   currinst  object     0
    date_ut  object     0
   date_obs  object     0
       cdec  object     0
     decoff float64     0
   detector  object     0
   domestat  object     0
   dwfilcal  object     0
   dwfilerr   int32     0
   dwfilnam  object     0
   dwfilord   int32     0
   dwfilraw   int32     0
   dwfilsta  object     0
   dwfiltor float64     0
         el float64     0
   elaptime   int32     0
    equinox float64     0
   erasecnt   int32     0
   erasline   int32     0
   exposure   int32     0
     extend  object     0
     flamp3  object     0
     flamp4  object     0
     flamp5  object     0
     flamp6  object     0
   flimagin  object     0
   flspectr  object     0
   focalstn  object     0
      frame  object     0
    frameno   int32     0
         ha  object     0
   hatchpos  object     0
   imfltcal  object     0
   imflterr   int32     0
   imfltnam  object     0
   imfltord   int32     0
   imfltraw   int32     0
   imfltsta  object     0
   imflttor float64     0
     imtype  object     0
   instangl float64     0
   instflip  object     0
   instrume  object     0
   ioncurma float64     0
    ionpump  object     0
   keepprep   int32     0
    lampar1  object     0
    lampcu1  object     0
    lampfan  object     0
    lampne1  object     0
    lampne2  object     0
   lampqtz1  object     0
   latitude float64     0
   ldfltcal  object     0
   ldflterr   int32     0
   ldfltfop  object     0
   ldfltnam  object     0
   ldfltord   int32     0
   ldfltraw   int32     0
   ldfltsta  object     0
   ldflttor float64     0
        lst float64     0
        mjd float64     0
    mjd_obs float64     0
      naxis   int32     0
     naxis1   int32     0
     naxis2   int32     0
    nsubint   int32     0
    numamps   int32     0
     object  object     0
   observer  object     0
     obsnum   int32     0
    obstype  object     0
     outdir  object     0
    outfile  object     0
   ovrflush   int32     0
     parang float64     0
     poname  object     0
    poname1  object     0
    poname2  object     0
   postline   int32     0
    postpix   int32     0
     poxoff float64     0
     poxpos float64     0
    poxpos1 float64     0
    poxpos2 float64     0
     poyoff float64     0
     poypos float64     0
    poypos1 float64     0
    poypos2 float64     0
   preflush   int32     0
    preline   int32     0
     prepix   int32     0
   prismcal  object     0
   prismerr   int32     0
   prismfop  object     0
   prismnam  object     0
   prismord   int32     0
   prismraw   int32     0
   prismsta  object     0
   prismtor float64     0
    pwrblok float64     0
        cra  object     0
      raoff float64     0
    rotbase float64     0
   rotcalan float64     0
   rotcasid  object     0
    rotdest float64     0
   rotercnt float64     0
    roterrs  object     0
    rotmode  object     0
     rotoff float64     0
   rotpdsts float64     0
    rotposn float64     0
   rotpposn float64     0
   rotrefan float64     0
     rotsel  object     0
   rotsrver float64     0
    rotstst  object     0
    rotzero float64     0
    rowshft   int32     0
   secfocus float64     0
   secthetx float64     0
   secthety float64     0
   shutstat  object     0
   simulate  object     0
   slmskcal  object     0
   slmskerr   int32     0
   slmsknam  object     0
   slmskord   int32     0
   slmskraw   int32     0
   slmsksta  object     0
   slmsktor float64     0
         st  object     0
   synopfmt  object     0
   synopsis  object     0
    targdec float64     0
   targepoc float64     0
   targequi float64     0
   targfram  object     0
   targname  object     0
   targplax float64     0
   targpmdc float64     0
   targpmra float64     0
     targra float64     0
   targradv float64     0
   telescop  object     0
   telfocus float64     0
    tempdet float64     0
   tmpbox0c float64     0
   tmpbox1c float64     0
    tmpcamc float64     0
   tmpcin0c float64     0
   tmpcin1c float64     0
   tmpcollc float64     0
   tmpcou0c float64     0
   tmpcou1c float64     0
   tmpele0c float64     0
   tmpele1c float64     0
    tmpextc float64     0
   tmpfrm1c float64     0
   tmpfrm2c float64     0
    tmpintc float64     0
   tmplampc float64     0
    tmpossc float64     0
   tmpprsmc float64     0
     todisk  object     0
      ttime   int32     0
   tubetemp float64     0
   tvfilcal  object     0
   tvfilerr   int32     0
   tvfilfop  object     0
   tvfilnam  object     0
   tvfilord   int32     0
   tvfilraw   int32     0
   tvfilsta  object     0
   tvfiltor float64     0
     tvflip  object     0
   tvfoccal  object     0
   tvfocerr   int32     0
   tvfocfop  object     0
   tvfocnam  object     0
   tvfocord   int32     0
   tvfocraw   int32     0
   tvfocsta  object     0
   tvfoctor float64     0
    tvpower  object     0
         ut  object     0
    utbfans  object     0
    utbtemp float64     0
   voffset0   int32     0
   voffset1   int32     0
   voffset2   int32     0
   voffset3   int32     0
     window  object     0
      xflip  object     0
      yflip   int32     0
         ra float64     0
        dec float64     0
 utdatetime  object     0
   filehand  object     0
      semid  object     0
          x float64     0
          y float64     0
          z float64     0
    spt_ind   int32     0
Jobid: tap_6s3q_g1q
Phase: COMPLETED
Owner: None
Output file: async_20210303142804.vot
Results: None

Select columns acquired on UT Date

In [6]:
sql = "select koaid, filehand  from koa_esi \
    where koaid like '%20150902%' "
job = koa.launch_job_async(sql, dump_to_file=True, output_file='columns.tbl', output_format='ipac')
r = job.get_results()
print(r)
print('\n\n')
print(job)
        koaid                                filehand                     
---------------------- ---------------------------------------------------
ES.20150902.10478.fits /koadata36/ESI/20150902/lev0/ES.20150902.10478.fits
ES.20150902.10550.fits /koadata36/ESI/20150902/lev0/ES.20150902.10550.fits
ES.20150902.45958.fits /koadata36/ESI/20150902/lev0/ES.20150902.45958.fits
ES.20150902.46025.fits /koadata36/ESI/20150902/lev0/ES.20150902.46025.fits
ES.20150902.46101.fits /koadata36/ESI/20150902/lev0/ES.20150902.46101.fits
ES.20150902.46168.fits /koadata36/ESI/20150902/lev0/ES.20150902.46168.fits
ES.20150902.46410.fits /koadata36/ESI/20150902/lev0/ES.20150902.46410.fits
ES.20150902.85368.fits /koadata36/ESI/20150903/lev0/ES.20150902.85368.fits
ES.20150902.85427.fits /koadata36/ESI/20150903/lev0/ES.20150902.85427.fits
ES.20150902.85487.fits /koadata36/ESI/20150903/lev0/ES.20150902.85487.fits
ES.20150902.85546.fits /koadata36/ESI/20150903/lev0/ES.20150902.85546.fits
ES.20150902.85605.fits /koadata36/ESI/20150903/lev0/ES.20150902.85605.fits
ES.20150902.85664.fits /koadata36/ESI/20150903/lev0/ES.20150902.85664.fits



<Table length=13>
  name   dtype
-------- -----
   koaid str22
filehand str51
Jobid: tap_fy2ex9am
Phase: COMPLETED

Owner: None
Output file: columns.tbl
Results: None

Select a maximum number of records

In [7]:
sql="select top 5 koaid, filehand, frameno from koa_esi \
    where koaid like '%20150902%'"

job = koa.launch_job_async(sql, dump_to_file=True, output_file='top5.tbl', output_format='ipac')
r = job.get_results()
print(r)
print('\n\n')
print(job)
        koaid          ... frameno
---------------------- ... -------
ES.20150902.10478.fits ...       1
ES.20150902.10550.fits ...       2
ES.20150902.45958.fits ...       3
ES.20150902.46025.fits ...       4
ES.20150902.46101.fits ...       5



<Table length=5>
  name   dtype
-------- -----
   koaid str22
filehand str51
 frameno int64
Jobid: tap_98qkawea
Phase: COMPLETED

Owner: None
Output file: top5.tbl
Results: None

Select columns and search by date range

In [8]:
sql="select koaid, filehand from koa_esi \
     where (utdatetime >= to_date('2015-09-01 00:00:00', \
    'yyyy-mm-dd HH24:MI:SS') and \
     utdatetime <= to_date('2015-09-30 23:59:59', 'yyyy-mm-dd HH24:MI:SS'))"


job = koa.launch_job_async(sql, dump_to_file=True, output_file='DateRange.tbl', output_format='ipac')
r = job.get_results()
print(r)
print('\n\n')
print(job)
        koaid                                filehand                     
---------------------- ---------------------------------------------------
ES.20150902.10478.fits /koadata36/ESI/20150902/lev0/ES.20150902.10478.fits
ES.20150902.10550.fits /koadata36/ESI/20150902/lev0/ES.20150902.10550.fits
ES.20150902.45958.fits /koadata36/ESI/20150902/lev0/ES.20150902.45958.fits
ES.20150902.46025.fits /koadata36/ESI/20150902/lev0/ES.20150902.46025.fits
ES.20150902.46101.fits /koadata36/ESI/20150902/lev0/ES.20150902.46101.fits
ES.20150902.46168.fits /koadata36/ESI/20150902/lev0/ES.20150902.46168.fits
ES.20150902.46410.fits /koadata36/ESI/20150902/lev0/ES.20150902.46410.fits
ES.20150902.85368.fits /koadata36/ESI/20150903/lev0/ES.20150902.85368.fits
ES.20150902.85427.fits /koadata36/ESI/20150903/lev0/ES.20150902.85427.fits
ES.20150902.85487.fits /koadata36/ESI/20150903/lev0/ES.20150902.85487.fits
                   ...                                                 ...
ES.20150911.24831.fits /koadata36/ESI/20150911/lev0/ES.20150911.24831.fits
ES.20150911.26693.fits /koadata36/ESI/20150911/lev0/ES.20150911.26693.fits
ES.20150911.35455.fits /koadata36/ESI/20150911/lev0/ES.20150911.35455.fits
ES.20150911.42470.fits /koadata36/ESI/20150911/lev0/ES.20150911.42470.fits
ES.20150911.44332.fits /koadata36/ESI/20150911/lev0/ES.20150911.44332.fits
ES.20150911.46194.fits /koadata36/ESI/20150911/lev0/ES.20150911.46194.fits
ES.20150911.48056.fits /koadata36/ESI/20150911/lev0/ES.20150911.48056.fits
ES.20150911.50078.fits /koadata36/ESI/20150911/lev0/ES.20150911.50078.fits
ES.20150911.51339.fits /koadata36/ESI/20150911/lev0/ES.20150911.51339.fits
ES.20150911.52604.fits /koadata36/ESI/20150911/lev0/ES.20150911.52604.fits
ES.20150911.53867.fits /koadata36/ESI/20150911/lev0/ES.20150911.53867.fits
Length = 225 rows



<Table length=225>
  name   dtype
-------- -----
   koaid str22
filehand str51
Jobid: tap_vr4_sfjh
Phase: COMPLETED

Owner: None
Output file: DateRange.tbl
Results: None

Search by program ID

In [9]:
sql= ("select koaid, filehand, progid, ha, az \
    from koa_esi where (progid = 'K197E') ")



job = koa.launch_job_async(sql, dump_to_file=True, output_file='ProgramID.tbl', output_format='ipac')

r = job.get_results()
print(r)
print('\n\n')
print(job)
        koaid          ...      az     
---------------------- ... ------------
ES.20140724.08809.fits ...  57.99963545
ES.20140724.09553.fits ...  57.99963672
ES.20140724.10762.fits ...  57.99963736
ES.20140724.10811.fits ...    57.999638
ES.20140724.11148.fits ...    57.999638
ES.20140724.11286.fits ...  57.99963864
ES.20140724.11391.fits ...  57.99963864
ES.20140724.11496.fits ...  57.99963864
ES.20140724.11615.fits ...  57.99963928
ES.20140724.11721.fits ...  57.99963991
                   ... ...          ...
ES.20140724.33747.fits ... 200.97536896
ES.20140724.33833.fits ... 201.39384859
ES.20140724.33919.fits ... 201.81847091
ES.20140724.34019.fits ... 202.29891756
ES.20140724.34713.fits ... 205.58013977
ES.20140724.35396.fits ... 208.66363454
ES.20140724.36090.fits ... 211.63996849
ES.20140724.36465.fits ... 213.18497377
ES.20140724.36862.fits ... 214.76645206
ES.20140724.36948.fits ... 215.10402524
ES.20140724.37034.fits ... 215.44095486
Length = 105 rows



<Table length=105>
  name    dtype 
-------- -------
   koaid   str22
filehand   str51
  progid    str5
      ha   str12
      az float64
Jobid: tap_3kn_m8pg
Phase: COMPLETED

Owner: None
Output file: ProgramID.tbl
Results: None
In [10]:
sql=("select koaid, filehand, ra, dec from koa_esi where \
    contains(point('icrs', ra, dec), \
    circle('icrs', 255.03913 -11.82214 1.0)) = 1")

job = koa.launch_job_async(sql, dump_to_file=True, output_file='ConeSearch.tbl', output_format='ipac')

r = job.get_results()
print(r)
print('\n\n')
print(job)
        koaid          ...    dec   
---------------------- ... ---------
ES.20140724.19862.fits ... -11.82214
ES.20140724.19954.fits ... -11.82214
ES.20140724.20187.fits ... -11.82214
ES.20140724.20277.fits ... -11.82214
ES.20140724.20549.fits ... -11.82214
ES.20140724.20649.fits ... -11.82214
ES.20140724.20925.fits ... -11.82214
ES.20140724.21025.fits ... -11.82214



<Table length=8>
  name    dtype 
-------- -------
   koaid   str22
filehand   str51
      ra float64
     dec float64
Jobid: tap_o9h0pzx1
Phase: COMPLETED

Owner: None
Output file: ConeSearch.tbl
Results: None
In [11]:
sql=("select koaid, filehand, ra, dec from koa_esi where \
     contains(point('icrs', ra, dec), \
     box('icrs',23.48, 30.60,1.0,120)) = 1")

job = koa.launch_job_async(sql, dump_to_file=True, output_file='Spat_Box.tbl', \
                           output_format='ipac')
r = job.get_results()
print(r)
print('\n\n')
print(job)
        koaid          ...   dec   
---------------------- ... --------
ES.19990831.33124.fits ... 89.72169
ES.19990831.33223.fits ... 89.72169
ES.19990831.33424.fits ... 89.72169
ES.19990831.33559.fits ... 89.72169
ES.19990831.33822.fits ... 89.72169
ES.19990831.34017.fits ... 89.72169
ES.19990831.34113.fits ... 89.72169
ES.19990831.34210.fits ... 89.72169
ES.19990831.34307.fits ... 89.72169
ES.19990831.35315.fits ... 89.72169
                   ... ...      ...
ES.20190506.77803.fits ...    90.01
ES.20190506.77915.fits ...    90.01
ES.20190506.78101.fits ...    90.01
ES.20190506.78161.fits ...    90.01
ES.20190506.78213.fits ...    90.01
ES.20190506.78268.fits ...    90.01
ES.20190506.78320.fits ...    90.01
ES.20190506.78374.fits ...    90.01
ES.20190506.78428.fits ...    90.01
ES.20190506.78482.fits ...    90.01
ES.20190506.78535.fits ...    90.01
Length = 1355 rows



<Table length=1355>
  name    dtype 
-------- -------
   koaid   str22
filehand   str51
      ra float64
     dec float64
Jobid: tap_jutu0g_o
Phase: COMPLETED

Owner: None
Output file: Spat_Box.tbl
Results: None
In [ ]:
sql=("select koaid, filehand, ra, dec from koa_esi  where \
    contains(point('icrs', ra, dec), \
    polygon('icrs',209.80225,53.34894,209.80225,55.34894,211.80225,54.34894)) = 1")

job = koa.launch_job_async(sql, dump_to_file=True, output_file='Spat_Poly.tbl', \
                           output_format='ipac')
r = job.get_results()
print(r)

Count number of records in date range

In [ ]:
sql=("select count(*) from koa_esi where \
    (utdatetime >= to_date('2015-09-01 00:00:00', 'yyyy-mm-dd HH24:MI:SS') and \
     utdatetime <= to_date('2015-09-30 23:59:59', 'yyyy-mm-dd HH24:MI:SS'))"  )



job = koa.launch_job_async(sql, dump_to_file=True, output_file='Count_daterange.tbl', \
                           output_format='ipac')
r = job.get_results()
print(r)
print('\n\n')
print(job)

Count total number of records in table

In [14]:
sql="select count(*) as total from koa_esi"

job = koa.launch_job_async(sql, dump_to_file=True, output_file='Count_table.tbl', \
                           output_format='ipac')
r = job.get_results()
print(r)
print('\n\n')
print(job)
total
-----
69477



<Table length=1>
 name dtype
----- -----
total int64
Jobid: tap_o__3flh0
Phase: COMPLETED

Owner: None
Output file: Count_table.tbl
Results: None

Note that in asynchronous mode, TAP+ returns all records.


Visit KOA at https://koa.ipac.caltech.edu.

The Keck Observatory Archive (KOA) is a collaboration between the NASA Exoplanet Science Institute (NExScI) and the W. M. Keck Observatory (WMKO). NExScI is sponsored by NASA's Exoplanet Exploration Program, and operated by the California Institute of Technology in coordination with the Jet Propulsion Laboratory (JPL).

Need help? Submit your questions to the KOA Help Desk at https://koa.ipac.caltech.edu/cgi-bin/Helpdesk/nph-genTicketForm?projname=KO

In [ ]: