【发布时间】:2020-01-22 02:56:29
【问题描述】:
我在表上的 Snowflake 中创建了一个 Stream,并创建了一个将数据移动到表中的任务。即使任务完成后,流中的数据也不会被清除。因此,该任务不会被跳过并继续将数据从流中重新插入到表中,并且最终表继续增长。可能是什么原因?它昨天还在工作,但从今天开始,即使在使用任务使用该流执行 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
【问题讨论】:
-
任务运行的是什么 SQL?它需要包含一些 sql 以插入另一个表/创建另一个表,它不能简单地是我记得的流上的选择。
-
嗨 SimonD,请在上面的帖子中找到 SQL。
标签: snowflake-cloud-data-platform