我正在尝试构建一些任务来自动化我的一些流程。我已经包含了成功执行并手动测试的任务的代码,它达到了正确的最终结果。另外,请原谅我缺乏 SQL 礼仪,大约一个月前才开始研究数据库并真正学习 SQL。
以下是任务的恢复命令。第一个工作正常,其他三个却不行。
alter task create_hubspot_mql_yesterday_table resume;
alter task create_pega_mql_yesterday_table resume;
alter task create_hubspot_pega_diff_yesterday_table resume;
alter task suspendwarehouse3 resume;
我得到的错误是: 无法使用根任务XXXX更新图形,因为该根任务未挂起。
-- task 1: creates the hubspot mql yesterday report from hubspot data
create or replace task create_hubspot_mql_yesterday_table
warehouse = pc_fivetran_wh
schedule = 'USING CRON 0 6-20 * * MON-FRI America/Denver'
as create or replace table myfirstdatabase.hubspot.hubspot_mql_yesterday
as select * from pc_fivetran_db.hubspot.contact where PROPERTY_HS_LIFECYCLESTAGE_MARKETINGQUALIFIEDLEAD_DATE < current_date
and PROPERTY_HS_LIFECYCLESTAGE_MARKETINGQUALIFIEDLEAD_DATE > current_date - INTERVAL '1 d';
-- task 2: creates the pega mql yesterday report from pega lead data
create or replace task create_pega_mql_yesterday_table
warehouse = pc_fivetran_wh
after create_hubspot_mql_yesterday_table
as create or replace table myfirstdatabase.hubspot.pega_mql_yesterday
as select * from myfirstdatabase.public.pega_leads where BECAMEAMQLDATE <= current_date + INTERVAL '7 h'
and BECAMEAMQLDATE >= current_date - INTERVAL '1 d';
-- task 3: full outer join to determine differnce in id's between hubspot and pega tables
create or replace task create_hubspot_pega_diff_yesterday_table
warehouse = pc_fivetran_wh
after create_pega_mql_yesterday_table
as create or replace table myfirstdatabase.hubspot.hubspot_pega_mql_yesterday_delta
as select
myfirstdatabase.hubspot.hubspot_mql_yesterday.id as hubspot_contact_id,
myfirstdatabase.hubspot.pega_mql_yesterday.hubspotcontactid as pega_hubspot_contact_id
from myfirstdatabase.hubspot.hubspot_mql_yesterday
full outer join myfirstdatabase.hubspot.pega_mql_yesterday
on myfirstdatabase.hubspot.hubspot_mql_yesterday.id = myfirstdatabase.hubspot.pega_mql_yesterday.hubspotcontactid
where myfirstdatabase.hubspot.hubspot_mql_yesterday.id is null or myfirstdatabase.hubspot.pega_mql_yesterday.hubspotcontactid is null;
-- task 4: suspend the warehouse after the chain of tasks
create or replace task suspendwarehouse3
warehouse = pc_fivetran_wh
after create_hubspot_pega_diff_yesterday_table
as
alter warehouse compute_wh suspend;
创建任务时,它们会成功执行。
当我运行 show tasks 命令时:
show tasks in pc_fivetran_db.hubspot;
我感谢任何有关如何解决此错误的帮助或建议。