Hello!
I am on retool self hosted, on v3.148.6
Goal
I am creating an automation workflow that fetches HubSpot API data (triggered by a webhook), cleans it (python script) and then upserts a DB table named 'hubspot'.
The api data is fetched and transformed well.
The issue arises in the upsert block, it returns an error that the column (probability) doesn't exist.
INSERT INTO hubspot (
id,
dealname,
company_name,
country,
spv_name,
country_of_spv,
deal_stages,
createdate,
hs_lastmodifieddate,
pipeline,
pv_wind_bess,
deal_currency_code,
legal_entity,
type,
amount__set_up_,
amount__recuring_,
contract_term,
deal_reference,
contract_execution_date,
job_code,
probability
)
VALUES (
{{ cleanDealsPy.data.id }},
{{ cleanDealsPy.data.dealname }},
{{ cleanDealsPy.data.company_name }},
{{ cleanDealsPy.data.country }},
{{ cleanDealsPy.data.spv_name }},
{{ cleanDealsPy.data.country_of_spv }},
{{ cleanDealsPy.data.deal_stages }},
{{ cleanDealsPy.data.createdate }},
{{ cleanDealsPy.data.hs_lastmodifieddate }},
{{ cleanDealsPy.data.pipeline }},
{{ cleanDealsPy.data.pv_wind_bess }},
{{ cleanDealsPy.data.deal_currency_code }},
{{ cleanDealsPy.data.legal_entity }},
{{ cleanDealsPy.data.type }},
{{ cleanDealsPy.data.amount__set_up_ }},
{{ cleanDealsPy.data.amount__recuring_ }},
{{ cleanDealsPy.data.contract_term }},
{{ cleanDealsPy.data.deal_reference }},
{{ cleanDealsPy.data.contract_execution_date }},
{{ cleanDealsPy.data.job_code }},
{{ cleanDealsPy.data.probability}}
)
ON CONFLICT (id) DO UPDATE SET
dealname = EXCLUDED.dealname,
company_name = EXCLUDED.company_name,
country = EXCLUDED.country,
spv_name = EXCLUDED.spv_name,
country_of_spv = EXCLUDED.country_of_spv,
deal_stages = EXCLUDED.deal_stages,
createdate = EXCLUDED.createdate,
hs_lastmodifieddate = EXCLUDED.hs_lastmodifieddate,
pipeline = EXCLUDED.pipeline,
pv_wind_bess = EXCLUDED.pv_wind_bess,
deal_currency_code = EXCLUDED.deal_currency_code,
legal_entity = EXCLUDED.legal_entity,
type = EXCLUDED.type,
amount__set_up_ = EXCLUDED.amount__set_up_,
amount__recuring_ = EXCLUDED.amount__recuring_,
contract_term = EXCLUDED.contract_term,
deal_reference = EXCLUDED.deal_reference,
contract_execution_date = EXCLUDED.contract_execution_date,
job_code = EXCLUDED.job_code,
probability = EXCLUDED.probability
WHERE EXCLUDED.hs_lastmodifieddate > hubspot.hs_lastmodifieddate;
I get the following error, I can confirm that the probability column does exist indeed in the hubspot DB table, so that can't be the issue.
I tried:
-
renaming the column in the DB
-
adding a new block to update the id after the upsert block:
-
deleting and re-adding the SQL block
-
Running the below to confirm the col:
select column_name, data_type
FROM information_schema.columns
where table_name = 'hubspot'
and column_name = 'probability';
- check if {{ cleanDealsPy.data.probability }} exists =>
select {{ cleanDealsPy.data.probability }} AS probability
and it does display the value - Use both direct value and fall back {{... || 0 }}
- Cannot find 'refresh schema' button in resource settings
I'm somewhat at my wits end
Could someone point me towards to the right direction.
Thanks!