From d3c9d95386c2b5a83f5dfd06687c37bc626f44c7 Mon Sep 17 00:00:00 2001 From: Deeman Date: Thu, 26 Feb 2026 19:50:27 +0100 Subject: [PATCH] fix(analytics): wrap max_date in ANY_VALUE() in get_weather_stress_latest DuckDB requires all selected columns to be aggregate expressions when there is no GROUP BY. latest.max_date is a scalar CTE value but still needs ANY_VALUE() wrapping to satisfy the binder. Co-Authored-By: Claude Opus 4.6 --- web/src/beanflows/analytics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/beanflows/analytics.py b/web/src/beanflows/analytics.py index e0e529f..d429bfc 100644 --- a/web/src/beanflows/analytics.py +++ b/web/src/beanflows/analytics.py @@ -677,7 +677,7 @@ async def get_weather_stress_latest() -> dict | None: FROM serving.weather_daily ) SELECT - latest.max_date AS observation_date, + ANY_VALUE(latest.max_date) AS observation_date, ROUND(AVG(w.crop_stress_index), 1) AS avg_crop_stress_index, MAX(w.crop_stress_index) AS max_crop_stress_index, COUNT(*) FILTER (WHERE w.crop_stress_index > 20) AS locations_under_stress,