From fcff09597fafa0d6523225ae4c9a6537748944f0 Mon Sep 17 00:00:00 2001 From: bn_user Date: Fri, 12 Dec 2025 08:20:50 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20dags/OSV=5Fwith=5Fdocs.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/OSV_with_docs.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/dags/OSV_with_docs.py b/dags/OSV_with_docs.py index 70aec56..6883ad1 100644 --- a/dags/OSV_with_docs.py +++ b/dags/OSV_with_docs.py @@ -332,17 +332,20 @@ def pogasheniya(**kwargs): # date_begin = EXCLUDED.date_begin, # date_end = EXCLUDED.date_end conn.execute(""" - UPDATE public.pogasheniya fp - SET id = subquery.new_id - FROM ( - SELECT - id, - ROW_NUMBER() OVER (ORDER BY uid_dogovor, schet, nomer) as new_id - FROM public.pogasheniya - ) AS subquery - WHERE fp.id = subquery.id; - """ - ) + UPDATE public.pogasheniya fp + SET id = subquery.new_id + FROM ( + SELECT + id, + -(ROW_NUMBER() OVER (ORDER BY uid_dogovor, schet, nomer)) as new_id + FROM public.pogasheniya + ) AS subquery + WHERE fp.id = subquery.id; + """) + conn.execute(""" + UPDATE public.pogasheniya + SET id = -id; + """) return 'Список обновлен.' else: return 'Обновлять нечего.'