恢复任务:无法使用根任务 *XXXX* 更新图形,因为该根任务未暂停

Resuming tasks: Unable to update graph with root task *XXXX* since that root task is not suspended

我正在尝试构建一些任务来自动化我的一些流程。我已经包含了我的任务的代码,这些代码成功执行并经过手动测试,它实现了正确的最终结果。另外,请原谅我缺乏 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;

这就是我得到的。

感谢任何有关如何修复此错误的帮助或建议。

您名为 create_pega_mql_yesterday_tablecreate_hubspot_pega_diff_yesterday_table 的子任务是 运行ning DDL 语句。

根据雪花任务 documentation 的 AFTER 参数,您可能需要先暂停根任务,然后才能 运行 这些任务,或使用等效的非 DDL 语句:

Executing DDL commands on any task in a tree of tasks requires that the root task is suspended. If the root task is currently resumed, then the command returns a user error.

在雪花中,您不能在子任务之前恢复父任务。始终在父任务之前恢复任务。在父任务之前恢复子任务不会导致任何问题,因为它们依赖于其父任务。