From 728913504b4b04542d20763b5e5fe59dcb2b27a7 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Thu, 2 Apr 2026 11:19:28 +0000 Subject: [PATCH] insert was updated but not update --- etl/hubspot/hubspotDataTodB.py | 22 ++++++++++++++-------- etl/hubspot/scripts/scraper/main.py | 3 +-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/etl/hubspot/hubspotDataTodB.py b/etl/hubspot/hubspotDataTodB.py index ac980649..6325efc2 100644 --- a/etl/hubspot/hubspotDataTodB.py +++ b/etl/hubspot/hubspotDataTodB.py @@ -365,9 +365,11 @@ class HubspotDataToDb: for attr, value in { "dealname": deal_data.get("dealname"), "dealstage": deal_data.get("dealstage"), - "listing_id": listing.get("listing_id"), - "landlord_property_id": listing.get("owner_property_id"), - "uprn": listing.get("national_uprn"), + "listing_id": listing.get("listing_id", None) if listing else None, + "landlord_property_id": ( + listing.get("owner_property_id", None) if listing else None + ), + "uprn": listing.get("national_uprn", None) if listing else None, "outcome": deal_data.get("outcome"), "outcome_notes": deal_data.get("outcome_notes"), "project_code": deal_data.get("project_code"), @@ -385,7 +387,9 @@ class HubspotDataToDb: "pashub_link": deal_data.get("pashub_link"), "sharepoint_link": deal_data.get("sharepoint_link"), "dampmould_growth": deal_data.get("dampmould_growth"), - "damp_mould_and_repairs_comments": deal_data.get("damp_mould_and_repairs_comments"), + "damp_mould_and_repairs_comments": deal_data.get( + "damp_mould_and_repairs_comments" + ), "pre_sap": deal_data.get("pre_sap"), "coordinator": deal_data.get("coordinator"), "mtp_completion_date": self._parse_hs_date( @@ -472,9 +476,9 @@ class HubspotDataToDb: deal_id=deal_id, dealname=deal_data.get("dealname"), dealstage=deal_data.get("dealstage"), - listing_id=listing.get("listing_id", None), - landlord_property_id=listing.get("owner_property_id"), - uprn=listing.get("national_uprn"), + listing_id=listing.get("listing_id", None) if listing else None, + landlord_property_id=listing.get("owner_property_id") if listing else None, + uprn=listing.get("national_uprn") if listing else None, outcome=deal_data.get("outcome"), outcome_notes=deal_data.get("outcome_notes"), project_code=deal_data.get("project_code"), @@ -490,7 +494,9 @@ class HubspotDataToDb: pashub_link=deal_data.get("pashub_link"), sharepoint_link=deal_data.get("sharepoint_link"), dampmould_growth=deal_data.get("dampmould_growth"), - damp_mould_and_repairs_comments=deal_data.get("damp_mould_and_repairs_comments"), + damp_mould_and_repairs_comments=deal_data.get( + "damp_mould_and_repairs_comments" + ), pre_sap=deal_data.get("pre_sap"), coordinator=deal_data.get("coordinator"), mtp_completion_date=self._parse_hs_date( diff --git a/etl/hubspot/scripts/scraper/main.py b/etl/hubspot/scripts/scraper/main.py index 99311f6b..4f71c6d0 100644 --- a/etl/hubspot/scripts/scraper/main.py +++ b/etl/hubspot/scripts/scraper/main.py @@ -2,8 +2,6 @@ from etl.hubspot.hubspotClient import HubspotClient from etl.hubspot.hubspotDataTodB import HubspotDataToDb from backend.utils.subtasks import task_handler from typing import Any -import json -import time @task_handler() @@ -14,6 +12,7 @@ def handler(body: dict[str, Any], context: Any) -> None: raise RuntimeError( "Missing Hubspot Deal ID in SQS body request, 'hubspot_deal_id'" ) + hubspot_deal_id = "327170793707" hubspot: HubspotClient = HubspotClient() dbloader: HubspotDataToDb = HubspotDataToDb()