eschutho opened a new pull request, #43422:
URL: https://github.com/apache/superset/pull/43422

   **Decisions made that were not in the instructions**
   None.
   
   ## What the warning was
   
   Production logs showed a recurring `WARNING` on every request that touched 
the bundled `birth_names` example data:
   
   ```
   The field `timeseries_limit_metric` is deprecated, please use 
`series_limit_metric` instead.
   ```
   
   `QueryObject._rename_deprecated_fields` (`superset/common/query_object.py`) 
fires this warning whenever it sees the old field name in incoming kwargs, then 
silently copies the value onto `series_limit_metric`. The example data shipped 
with Superset itself was still using the old name, so every load of the example 
dashboard/charts triggered the warning for no reason.
   
   ## What changed
   
   1. `superset/examples/birth_names.py` — renamed 4 `timeseries_limit_metric=` 
call sites to `series_limit_metric=` (the "Girls"/"Boys" table slices, one 
`echarts_timeseries_line` slice, and the "Names Sorted by Num in California" 
slice).
   2. `superset/examples/usa_births_names/charts/{Boys,Girls}.yaml` — same 
rename in the newer YAML-fixture version of the same example dashboard, which 
was hit by the same warning via a separate `load_examples_from_configs` code 
path.
   3. `superset/common/form_data_query_context.py` — `orderby_from_form_data()` 
only ever read the deprecated `timeseries_limit_metric` key when reconstructing 
a query straight from a chart's persisted `params` (used by dashboard Excel 
export and the MCP chart tools). That meant a chart saved with the *current* 
`series_limit_metric` field — like the examples fixed here — would silently 
lose its sort-by-metric through that specific path. Added a 
`series_limit_metric`-first fallback, matching the pattern already used in 
`query_object.py` and `models/helpers.py`.
   
   ## No behavior change
   
   `series_limit_metric` and `timeseries_limit_metric` are treated as fully 
equivalent everywhere in the normal query/chart-data path (`QueryObject`, 
`get_sqla_query`, `ChartDataQueryObjectSchema`) — the rename is a no-op there 
other than dropping the warning. Item 3 above is a genuine bug fix for the one 
path that previously checked only the old key, but restores intended behavior 
(existing sort-by-metric) rather than changing it.
   
   ## Test plan
   
   - `superset/examples/usa_births_names/charts/{Boys,Girls}.yaml` — validated 
as parseable YAML.
   - `tests/unit_tests/common/test_form_data_query_context.py` — added two 
tests: `series_limit_metric` alone produces the same `orderby` as the 
deprecated field, and `series_limit_metric` takes precedence when both are 
present. Confirmed fail-before/pass-after against the pre-fix code (both new 
tests fail on `main`, pass after the `form_data_query_context.py` change).
   - `ruff check` / `ruff format --check` clean on all changed Python files.
   - Full targeted suite: `pytest 
tests/unit_tests/common/test_form_data_query_context.py` → 40 passed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to