fix(tradein): backfill kn price_per_m2 via sale_graph + peer median (#573) #625
1 changed files with 2 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
-- 100_backfill_kn_price_per_m2.sql
|
-- 120_backfill_kn_price_per_m2.sql
|
||||||
-- Context: Issue #573 — domrf_kn_flats.price_per_m2 is populated in only ~3.7%
|
-- Context: Issue #573 — domrf_kn_flats.price_per_m2 is populated in only ~3.7%
|
||||||
-- of rows (status='free'/'sold'/'booked'). The 756 977 NULL-status rows imported
|
-- of rows (status='free'/'sold'/'booked'). The 756 977 NULL-status rows imported
|
||||||
-- from historical DOM.RF snapshots carry total_area but no price_rub, so the
|
-- from historical DOM.RF snapshots carry total_area but no price_rub, so the
|
||||||
|
|
@ -68,7 +68,7 @@ WITH peer AS (
|
||||||
GROUP BY obj_id
|
GROUP BY obj_id
|
||||||
)
|
)
|
||||||
UPDATE public.domrf_kn_flats f
|
UPDATE public.domrf_kn_flats f
|
||||||
SET price_per_m2 = ROUND(p.median_ppm2, 2)
|
SET price_per_m2 = ROUND(p.median_ppm2::numeric, 2)
|
||||||
FROM peer p
|
FROM peer p
|
||||||
WHERE f.obj_id = p.obj_id
|
WHERE f.obj_id = p.obj_id
|
||||||
AND f.price_per_m2 IS NULL;
|
AND f.price_per_m2 IS NULL;
|
||||||
Loading…
Add table
Reference in a new issue