mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
first time script
This commit is contained in:
parent
d3a7260806
commit
702d13542d
2 changed files with 48 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
45
etl/hubSpotClient/hubspot_company.py
Normal file
45
etl/hubSpotClient/hubspot_company.py
Normal file
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Reference in a new issue