Closed PavelIgin closed 5 months ago
i want user this code but Window() func not working exclude_next = Q(value=F('next_value')) | Q(value=F('second_next_value')) exclude_prev = Q(value=F('prev_value')) | Q(value=F('second_prev_value')) queryset = ValueChart.objects.filter(signal=signal.id, date_time__range=( validated_data.get('date_time_before', None), validated_data.get('date_time_after', None)) ).annotate(next_value=Window( expression=Lead('value')), second_next_value=Window( expression=Lead('value', 2)), prev_value=Window(Lag('value')), second_prev_value=Window(Lag('value', 2)) ).order_by('date_time').exclude(exclude_next, exclude_prev ).annotate(x=F('date_time'), y=F('value')).order_by( 'date_time').values('x','y')
more details needed, please follow the bug template and open a new issue .
django raised NotSupportedError: This backend does not support window expressions.
i want user this code but Window() func not working exclude_next = Q(value=F('next_value')) | Q(value=F('second_next_value')) exclude_prev = Q(value=F('prev_value')) | Q(value=F('second_prev_value')) queryset = ValueChart.objects.filter(signal=signal.id, date_time__range=( validated_data.get('date_time_before', None), validated_data.get('date_time_after', None)) ).annotate(next_value=Window( expression=Lead('value')), second_next_value=Window( expression=Lead('value', 2)), prev_value=Window(Lag('value')), second_prev_value=Window(Lag('value', 2)) ).order_by('date_time').exclude(exclude_next, exclude_prev ).annotate(x=F('date_time'), y=F('value')).order_by( 'date_time').values('x','y')