我在表上创建了“雪花流”,并创建了将数据移动到表中的任务。即使在任务完成之后,流中的数据也不会被清除。由于这个原因,任务没有被跳过,而是不断地将数据从流重新插入到表中,最后一个表继续增长。原因是什么?它昨天开始工作,但从今天开始,即使在使用DML使用任务执行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发布于 2020-01-21 18:05:14
在DML操作中,您似乎没有使用该流。您正在从构建流的表中插入行,而不是从流本身插入行。为了推进流,您需要将“从test_table_raw”更改为“从test_stream”。试试看让我知道。
谢谢。
https://stackoverflow.com/questions/59845036
复制相似问题