Compare commits
No commits in common. "6d3fad6b963978550c7215b72f6de2cf78d28cd1" and "367b2719a9ab19a12538acbc761b808715601d8b" have entirely different histories.
6d3fad6b96
...
367b2719a9
2 changed files with 6 additions and 12 deletions
|
|
@ -118,6 +118,7 @@ class ListingRow:
|
|||
year_built: int | None
|
||||
cadastral_number: str | None
|
||||
building_cadastral_number: str | None
|
||||
kadastr_num: str | None
|
||||
house_source: str | None
|
||||
house_ext_id: str | None
|
||||
house_url: str | None
|
||||
|
|
@ -151,7 +152,7 @@ class Stats:
|
|||
_LISTING_COLUMNS = (
|
||||
"id, source, source_id, source_url, dedup_hash, "
|
||||
"address, lat, lon, rooms, area_m2, floor, price_rub, year_built, "
|
||||
"cadastral_number, building_cadastral_number, "
|
||||
"cadastral_number, building_cadastral_number, kadastr_num, "
|
||||
"house_source, house_ext_id, house_url, house_id_fk"
|
||||
)
|
||||
|
||||
|
|
@ -216,6 +217,7 @@ def _fetch_batch(
|
|||
year_built=r["year_built"],
|
||||
cadastral_number=r["cadastral_number"],
|
||||
building_cadastral_number=r["building_cadastral_number"],
|
||||
kadastr_num=r["kadastr_num"],
|
||||
house_source=r["house_source"],
|
||||
house_ext_id=r["house_ext_id"],
|
||||
house_url=r["house_url"],
|
||||
|
|
@ -292,7 +294,7 @@ def _link_listing_to_house(
|
|||
lon=row.lon,
|
||||
year_built=row.year_built,
|
||||
building_cadastral_number=row.building_cadastral_number,
|
||||
cadastral_number=row.cadastral_number,
|
||||
cadastral_number=row.cadastral_number or row.kadastr_num,
|
||||
source_url=row.house_url or row.source_url,
|
||||
)
|
||||
house_resolved = house_id is not None
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ def _row(**overrides) -> ListingRow:
|
|||
"year_built": 2010,
|
||||
"cadastral_number": None,
|
||||
"building_cadastral_number": None,
|
||||
"kadastr_num": None,
|
||||
"house_source": None,
|
||||
"house_ext_id": None,
|
||||
"house_url": None,
|
||||
|
|
@ -146,6 +147,7 @@ def _row_dict(row: ListingRow) -> dict:
|
|||
"year_built": row.year_built,
|
||||
"cadastral_number": row.cadastral_number,
|
||||
"building_cadastral_number": row.building_cadastral_number,
|
||||
"kadastr_num": row.kadastr_num,
|
||||
"house_source": row.house_source,
|
||||
"house_ext_id": row.house_ext_id,
|
||||
"house_url": row.house_url,
|
||||
|
|
@ -209,16 +211,6 @@ def test_select_sql_filters_by_source_when_provided():
|
|||
assert "source = :source" in sql
|
||||
|
||||
|
||||
def test_select_sql_has_no_dropped_kadastr_num_column():
|
||||
"""`listings.kadastr_num` was dropped in 094_cadastral_unify.sql — the SELECT
|
||||
must not reference it or psycopg raises UndefinedColumn on every run."""
|
||||
sql = _build_select_sql(source=None, batch_size=500)
|
||||
assert "kadastr_num" not in sql
|
||||
# The canonical apartment-level cadastral columns remain.
|
||||
assert "cadastral_number" in sql
|
||||
assert "building_cadastral_number" in sql
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Happy path — one listing → 1 link + 1 house resolution
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue