@@ -47,7 +47,7 @@ def tap(self):
47
47
self ._tap = TAPService (baseurl = self .tap_url , session = self ._session )
48
48
return self ._tap
49
49
50
- def query_tap (self , query , * , maxrec = None ):
50
+ def query_tap (self , query , * , async_job = False , maxrec = None ):
51
51
"""
52
52
Send query to IRSA TAP. Results in `~pyvo.dal.TAPResults` format.
53
53
result.to_qtable in `~astropy.table.QTable` format
@@ -56,7 +56,9 @@ def query_tap(self, query, *, maxrec=None):
56
56
----------
57
57
query : str
58
58
ADQL query to be executed
59
- maxrec : int
59
+ async_job : bool, optional
60
+ if True query is run in asynchronous mode
61
+ maxrec : int, optional
60
62
maximum number of records to return
61
63
62
64
Returns
@@ -69,8 +71,12 @@ def query_tap(self, query, *, maxrec=None):
69
71
TAP query result as `~astropy.table.QTable`
70
72
71
73
"""
72
- log .debug (f'TAP query: { query } ' )
73
- return self .tap .search (query , language = 'ADQL' , maxrec = maxrec )
74
+ log .debug (f'Query is run in async mode: { async_job } \n TAP query: { query } ' )
75
+
76
+ if async_job :
77
+ return self .tap .run_async (query , language = 'ADQL' , maxrec = maxrec )
78
+ else :
79
+ return self .tap .run_sync (query , language = 'ADQL' , maxrec = maxrec )
74
80
75
81
def query_sia (self , * , pos = None , band = None , time = None , pol = None ,
76
82
field_of_view = None , spatial_resolution = None ,
@@ -155,7 +161,7 @@ def list_collections(self, servicetype=None):
155
161
@deprecated_renamed_argument (("selcols" , "cache" , "verbose" ), ("columns" , None , None ), since = "0.4.7" )
156
162
def query_region (self , coordinates = None , * , catalog = None , spatial = 'Cone' ,
157
163
radius = 10 * u .arcsec , width = None , polygon = None ,
158
- get_query_payload = False , columns = '*' ,
164
+ get_query_payload = False , columns = '*' , async_job = False ,
159
165
verbose = False , cache = True ):
160
166
"""
161
167
Queries the IRSA TAP server around a coordinate and returns a `~astropy.table.Table` object.
@@ -190,6 +196,8 @@ def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
190
196
Defaults to `False`.
191
197
columns : str, optional
192
198
Target column list with value separated by a comma(,)
199
+ async_job : bool, optional
200
+ if True query is run in asynchronous mode
193
201
194
202
Returns
195
203
-------
@@ -239,7 +247,7 @@ def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
239
247
240
248
if get_query_payload :
241
249
return adql
242
- response = self .query_tap (query = adql )
250
+ response = self .query_tap (query = adql , async_job = async_job )
243
251
244
252
return response .to_table ()
245
253
0 commit comments