【发布时间】:2021-04-07 17:03:47
【问题描述】:
当任务正在执行使用流的查询时,我收到错误消息。错误仅在通过任务执行查询时出现。
在查询information_schema.task_history时,我可以看到任务状态为FAILED,错误代码为091111。我无法找到任何有关错误代码的文档,所以我主要依靠错误消息
Stream my_stream not found.
创建流时将SHOW_INITIAL_ROWS 参数设置为TRUE。这是因为源表已经存在了很长一段时间,我希望该任务除了处理传入数据之外还处理过去的数据。
我注意到了什么
SYSTEM$STREAM_HAS_DATA 返回 False,直到出现新的 CDC。由于SHOW_INITIAL_ROWS 设置为TRUE,当我查询流时,我得到的行数与查询表本身时相同。但是,SYSTEM$STREAM_HAS_DATA 仍然返回 False。
我的尝试
- 可以查询流
我已通过使用此角色和查询确认任务所有者有权访问流。
SELECT * FROM my_stream LIMIT 5; -- Works.
这证实了流确实存在。
-
执行 UPDATE 命令确实会使
SYSTEM$STREAM_HAS_DATA返回带有所有行的TRUE(而不仅仅是这个命令的差异)。 -
我可以运行任务本身的 SQL。进入历史页面,我可以复制并粘贴查询并运行它。
这确认查询本身有效。
- 随后的更改实际上由任务处理。
我需要帮助的地方
- 我需要在没有人工干预和执行的情况下处理流的任务,以使流看起来存在
我假设通过手动执行查询,幕后发生了一些事情,使得该流可以访问。 An example of this would be a stream being created on at able by its owner enables change tracking on that table. 但是,我一直无法找到导致在查询之前无法找到流的情况的原因。
更新:重现错误的分步说明
遇到了更容易查看发生了什么的错误。从那里,能够提出逐步说明来重现错误。
首先,没有 show_initial_rows
use database stream_database;
use schema stream_schema;
create table test_table (a integer);
create stream test_stream on table test_table;
select * from test_stream; -- Works
select * from stream_database.stream_schema.test_stream; -- Works
use database different_database; -- Use a different database
select * from stream_database.stream_schema.test_stream; -- Still works
现在,show_initial_rows 设置为 TRUE
use database stream_database;
use schema stream_schema;
create table test_table (a integer);
create stream test_stream on table test_table **show_initial_rows** = true;
select * from test_stream; -- Works
select * from stream_database.stream_schema.test_stream; -- Works
use database different_database;
select * from stream_database.stream_schema.test_stream; -- Error is raised!
select * from stream_database.stream_schema.test_table; -- Works, so there is still access to the table.
(假定)预期行为:在流上启用 show_initial_rows 不应更改流可访问的范围。
【问题讨论】:
-
根据您今天的更新和您提供的代码示例,您似乎遇到了我昨天发布的类似问题 Snowflake - “Stream not found” when accessing using fully-qualified name from different schema
-
@LukaszSzozda 这似乎是同一个问题。我也刚刚收到 Snowflake 的回复——他们说修复正在等待部署,所以希望它很快就会修复
标签: snowflake-cloud-data-platform