我正在尝试构建一些任务来自动化我的一些过程。我已经为我的任务包括了成功执行和手动测试的代码,它达到了正确的最终结果。另外,请原谅我缺乏SQL礼仪,一个月前刚开始研究DB,并真正学习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 in pc_fivetran_db.hubspot;这就是我得到的。

我很感激任何关于如何修复这个错误的帮助或建议。
发布于 2020-01-16 18:09:52
在雪花中,不能在子任务之前恢复父任务。始终在父任务之前恢复任务。在父任务之前恢复子任务不会导致任何问题,因为它们依赖于其父任务。
发布于 2022-09-16 23:57:24
我在为这件事苦苦挣扎。特别是当我继续下一个子任务时,我会出错。
无法使用根任务更新图形,因为该根任务没有挂起。
正如错误描述的那样,我必须先挂起root_task,然后继续下一个子任务。但是,通过这样做,子任务永远不会被执行。相反,我发现您可以使用以下系统功能同时启用所有任务;
SELECT system$task_dependents_enable('<root_task_name>');https://stackoverflow.com/questions/59649384
复制相似问题