Skip to content

More powerful column selection in MastMissions#3492

Merged
bsipocz merged 3 commits into
astropy:mainfrom
snbianco:select-all-cols
Jan 26, 2026
Merged

More powerful column selection in MastMissions#3492
bsipocz merged 3 commits into
astropy:mainfrom
snbianco:select-all-cols

Conversation

@snbianco
Copy link
Copy Markdown
Contributor

@snbianco snbianco commented Jan 13, 2026

Make the select_cols parameter in MastMissions queries more powerful:

  • Specify a comma-separated string of columns in addition to a list of columns.
  • Specify all available columns with * or all
  • Now validates columns and warns (with suggestions) if a passed column does not exist.

I have also made the _json_to_table function more robust so that columns that have values of an unexpected type don't raise an error. Instead, a warning is logged and those particular values are masked.

@snbianco snbianco added the mast label Jan 13, 2026
@snbianco snbianco marked this pull request as ready for review January 13, 2026 20:11
@snbianco snbianco requested a review from bsipocz January 14, 2026 13:18
@bsipocz bsipocz added this to the 0.4.12 milestone Jan 21, 2026
Copy link
Copy Markdown
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good, but I wonder if the try/except exceptions can be better specified rather than blanket everything.

Comment thread astroquery/mast/missions.py Outdated

if isinstance(select_cols, str):
select_cols = select_cols.split(',')
elif not isinstance(select_cols, list):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking, but could it be other reasonable iterable, too, e.g. why don't we accept tuples or even a generator?

Comment thread astroquery/mast/services.py Outdated
data_table.add_column(
MaskedColumn(coerced, name=col_name, mask=ignore_mask)
)
except Exception:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be a blanket all Exceptions or could we narrow it a bit?

Comment thread astroquery/mast/services.py Outdated

try:
out[i] = col_type(val)
except Exception:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, this should be done with a very specific exception only

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.95%. Comparing base (09917e0) to head (85e64c5).
⚠️ Report is 263 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3492      +/-   ##
==========================================
+ Coverage   71.83%   71.95%   +0.12%     
==========================================
  Files         235      235              
  Lines       20273    20328      +55     
==========================================
+ Hits        14563    14627      +64     
+ Misses       5710     5701       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@snbianco
Copy link
Copy Markdown
Contributor Author

Made those changes!

Copy link
Copy Markdown
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@bsipocz bsipocz merged commit 71aebc4 into astropy:main Jan 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants