Skip to content

Commit 74c4856

Browse files
thodson-usgsclaude
andauthored
feat(waterdata): add max_rows to the OGC data getters to cap total results (#340)
* feat(waterdata): add max_rows to the OGC data getters to cap total results limit= on get_daily, get_continuous, get_monitoring_locations, get_time_series_metadata, get_combined_metadata, get_latest_continuous, get_latest_daily, get_field_measurements, get_field_measurements_metadata, get_peaks, and get_channel has always been a per-page size, not a result cap — _paginate follows every `next` link regardless, so a broad, unfiltered call (e.g. get_daily(parameter_code="00060", limit=10)) pages through the entire multi-year, nationwide result 10 rows at a time. Hit this live: it hung for 2+ minutes. get_ogc_data already threads a max_rows kwarg through to the _row_cap context var and _finalize_ogc's truncation (get_reference_table has used it since it was added); these 11 getters just never exposed it. Add max_rows: int | None = None to each, exclude it from the OGC query args, and pass it through to get_ogc_data. Each limit docstring now says explicitly that it's a page size, not a cap, and points to max_rows. get_cql builds its requests directly rather than through get_ogc_data, so it isn't covered here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent d8f630e commit 74c4856

2 files changed

Lines changed: 151 additions & 25 deletions

File tree

0 commit comments

Comments
 (0)