From 702d13542d366559a6c97566e10c7f4d5bb60adf Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Mon, 27 Oct 2025 20:19:18 +0000 Subject: [PATCH] first time script --- ...py => hubspot_abri_etl_first_time copy.py} | 6 +-- etl/hubSpotClient/hubspot_company.py | 45 +++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) rename etl/hubSpotClient/{hubspot_abri_etl_first_time.py => hubspot_abri_etl_first_time copy.py} (92%) create mode 100644 etl/hubSpotClient/hubspot_company.py diff --git a/etl/hubSpotClient/hubspot_abri_etl_first_time.py b/etl/hubSpotClient/hubspot_abri_etl_first_time copy.py similarity index 92% rename from etl/hubSpotClient/hubspot_abri_etl_first_time.py rename to etl/hubSpotClient/hubspot_abri_etl_first_time copy.py index 0bc75e1..9dc4e4c 100644 --- a/etl/hubSpotClient/hubspot_abri_etl_first_time.py +++ b/etl/hubSpotClient/hubspot_abri_etl_first_time copy.py @@ -29,7 +29,6 @@ deal_to_companies = {} loader = HubspotTodb() # Get all deals we care about for i,deal in enumerate(tqdm(deals)): - deal = "319667290322" company = hubspot.from_deal_get_associated_company_id(deal) if company in valueable_deals: deals_to_add.append(deal) @@ -40,6 +39,7 @@ for i,deal in enumerate(tqdm(deals)): - - +#TODO check if database has abri data +# make companies table +# make a scrip that updates table diff --git a/etl/hubSpotClient/hubspot_company.py b/etl/hubSpotClient/hubspot_company.py new file mode 100644 index 0000000..9dc4e4c --- /dev/null +++ b/etl/hubSpotClient/hubspot_company.py @@ -0,0 +1,45 @@ +from etl.hubSpotClient.hubspotClient import HubSpotClient, Companies, Pipeline +from tqdm import tqdm +from etl.db.hubSpotLoad import HubspotTodb + +''' +# TODO: + get one deal from db, from db + for avri only so far + add it to the db + show in frontend +''' + +# get ALL deals +hubspot = HubSpotClient() + +# All deals from a pipeline_id via filter +deals = hubspot.get_deal_ids_by_pipeline( + pipeline_id=Pipeline.OPERATIONS_SOCIAL_HOUSING.value, + ) + +# deals from companies we care about +valueable_deals = [ + Companies.ABRI.value +] +deals_to_add = [] + + +deal_to_companies = {} +loader = HubspotTodb() +# Get all deals we care about +for i,deal in enumerate(tqdm(deals)): + company = hubspot.from_deal_get_associated_company_id(deal) + if company in valueable_deals: + deals_to_add.append(deal) + deal_to_companies.update({deal: company}) + deal_data = hubspot.from_deal_get_info(deal_id=deal) + listing_data = hubspot.from_deal_get_associated_listing(deal_id=deal) + loader.new_record_to_hubspot_data(deal_data, deal_to_companies[deal], listing_data) + + + +#TODO check if database has abri data +# make companies table +# make a scrip that updates table +