Snowflake cloud data platform 雪花流数据保持

Snowflake cloud data platform 雪花流数据保持,snowflake-cloud-data-platform,snowflake-task,Snowflake Cloud Data Platform,Snowflake Task,我在表上的雪花中创建了一个流,并创建了一个将数据移动到表中的任务。即使任务完成后,流中的数据也不会被清除。正因为如此,任务并没有被跳过,而是继续将数据从流重新插入到表中,最终的表继续增长。原因可能是什么?它昨天还在工作,但从今天起,即使在使用任务流执行DML之后,流也不会清除 create or replace stream test_stream on table test_table_raw APPEND_ONLY = TRUE; create or replace task test_ta

我在表上的雪花中创建了一个流,并创建了一个将数据移动到表中的任务。即使任务完成后,流中的数据也不会被清除。正因为如此,任务并没有被跳过,而是继续将数据从流重新插入到表中,最终的表继续增长。原因可能是什么?它昨天还在工作,但从今天起,即使在使用任务流执行DML之后,流也不会清除

create or replace stream test_stream on table test_table_raw APPEND_ONLY = TRUE;
create or replace task test_task_task warehouse = test_warehouse
schedule = '1 minute'
when system$stream_has_data('test_stream') 
as insert into test_table
SELECT 
level1.FILE_NAME,
level1.FILE_ROWNUMBER,
GET(lvl, '@id')::string as app_id
FROM (SELECT FILE_NAME,FILE_ROWNUMBER,src:"$" as lvl FROM test_table_raw)  level1,
lateral FLATTEN(LVL:"$")  level2
where level2.value like '%<test %';

alter task test_task resume;

select 
(select count(*) from test_table) table_count,
(select count(*) from test_stream) stream_count;

TABLE_COUNT STREAM_COUNT
500             1

您似乎没有在DML操作中使用流。您正在从构建流的表而不是流本身插入行。为了推进流,您需要将test_table_raw更改为FROM test_stream。试试看,让我知道

谢谢