STREAM_STATUS(Lakehouse v1)
指定したストリームのステータスに関する情報を提供し、true または false のいずれかの値を取る単一列の結果(has_data)を返します。
true: ストリームに変更データキャプチャレコードが含まれている可能性があることを示します。false: ストリームに現在、変更データキャプチャレコードが含まれていないことを示します。
SQLの構文
Section titled “SQLの構文”SELECT * FROM STREAM_STATUS('<database_name>.<stream_name>');-- ORSELECT * FROM STREAM_STATUS('<stream_name>'); -- Uses current database-- Create a table 't' with a column 'c'CREATE TABLE t (c int);
-- Create a stream 's' on the table 't'CREATE STREAM s ON TABLE t;
-- Check the initial status of the stream 's'SELECT * FROM STREAM_STATUS('s');
-- The result should be 'false' indicating no change data capture records initially┌──────────┐│ has_data │├──────────┤│ false │└──────────┘
-- Insert a value into the table 't'INSERT INTO t VALUES (1);
-- Check the updated status of the stream 's' after the insertionSELECT * FROM STREAM_STATUS('s');
-- The result should now be 'true' indicating the presence of change data capture records┌──────────┐│ has_data │├──────────┤│ true │└──────────┘
-- Example with database name specifiedSELECT * FROM STREAM_STATUS('mydb.s');