テーブルは一日を通して更新されます。ユーザーは、20分ごとに変更された行のみを取得し、手動操作なしで変換を適用することで、テーブルの変更処理を自動化したいと考えています。これを実現するにはどうすればよいでしょうか?
正解:C
The correct answer is C. Create a stream and schedule a task every 20 minutes.
A stream is used to capture change data capture, or CDC, information for a table. It records inserts, updates, and deletes made to the source table. A task is used to automate SQL execution on a schedule. Together, streams and tasks are commonly used to automate incremental data processing in Snowflake.
Why C is correct:
The requirement has two parts:
Capture only changed rows.
Run the transformation automatically every 20 minutes.
A stream satisfies the first requirement because it tracks changed rows. A scheduled task satisfies the second requirement because it can run SQL logic at a defined interval, such as every 20 minutes.
Example concept:
CREATE STREAM my_stream
ON TABLE source_table;
CREATE TASK my_task
WAREHOUSE = my_warehouse
SCHEDULE = ' 20 MINUTE '
AS
INSERT INTO target_table
SELECT ...
FROM my_stream;
Why the other options are incorrect:
A). This is partially correct, but it does not clearly satisfy the requirement to run every 20 minutes. A task can include a WHEN SYSTEM$STREAM_HAS_DATA(...) condition, but the question specifically asks for processing every 20 minutes.
B). A task alone can run every 20 minutes, but it does not capture only changed rows.
D). Dynamic tables are used for declarative automated data transformation, but the question specifically asks to capture only changed rows from a frequently updated table, which is the purpose of a stream.
Official Snowflake documentation reference:
Snowflake documentation describes streams as objects that record data manipulation language, or DML, changes made to tables. Snowflake tasks execute SQL statements on a schedule or as part of a task graph.
Reference: Snowflake Documentation - Streams; Snowflake Documentation - Introduction to tasks; SnowPro Core Study Guide - SQL and Snowflake Objects.
==