Skip to content

Commit 065ea83

Browse files
authored
Merge pull request #2585 from bsipocz/alma_get_query_payload
ENH: get_query_payload to return useful info
2 parents 8d63241 + 09bd956 commit 065ea83

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

astroquery/alma/core.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def query_region_async(self, coordinate, radius, *, public=True,
335335
payload=payload, **kwargs)
336336

337337
def query_async(self, payload, *, public=True, science=True,
338-
legacy_columns=False, get_query_payload=None,
338+
legacy_columns=False, get_query_payload=False,
339339
maxrec=None, **kwargs):
340340
"""
341341
Perform a generic query with user-specified payload
@@ -380,11 +380,16 @@ def query_async(self, payload, *, public=True, science=True,
380380
payload['science_observation'] = science
381381
if public is not None:
382382
payload['public_data'] = public
383-
if get_query_payload:
384-
return payload
385383

386384
query = _gen_sql(payload)
385+
386+
if get_query_payload:
387+
# Return the TAP query payload that goes out to the server rather
388+
# than the unprocessed payload dict from the python side
389+
return query
390+
387391
result = self.query_tap(query, maxrec=maxrec)
392+
388393
if result is not None:
389394
result = result.to_table()
390395
else:

astroquery/alma/tests/test_alma.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def test_galactic_query():
538538
result = alma.query_region(SkyCoord(0*u.deg, 0*u.deg, frame='galactic'),
539539
radius=1*u.deg, get_query_payload=True)
540540

541-
assert result['ra_dec'] == SkyCoord(0*u.deg, 0*u.deg, frame='galactic').icrs.to_string() + ", 1.0"
541+
assert "'ICRS',266.405,-28.9362,1.0" in result
542542

543543

544544
def test_download_files():

0 commit comments

Comments
 (0)