STREAM_STATUS (Lakehouse v1)
지정한 스트림의 상태에 대한 정보를 제공하며, true 또는 false 값을 가질 수 있는 단일 열 결과(has_data)를 반환합니다.
true: 스트림에 변경 데이터 캡처 레코드가 있을 수 있음을 나타냅니다.false: 스트림에 현재 변경 데이터 캡처 레코드가 없음을 나타냅니다.
SQL 구문
섹션 제목: “SQL 구문”SELECT * FROM STREAM_STATUS('<database_name>.<stream_name>');-- ORSELECT * FROM STREAM_STATUS('<stream_name>'); -- Uses current databaseSQL 예제
섹션 제목: “SQL 예제”-- 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');