STREAM_STATUS (Lakehouse v1)
Fournit des informations sur l’état d’un flux spécifié et produit un résultat à une seule colonne (has_data) qui peut valoir true ou false :
true: indique que le flux peut contenir des enregistrements de capture de données modifiées.false: indique que le flux ne contient actuellement aucun enregistrement de capture de données modifiées.
Syntaxe SQL
Section intitulée « Syntaxe SQL »SELECT * FROM STREAM_STATUS('<database_name>.<stream_name>');-- ORSELECT * FROM STREAM_STATUS('<stream_name>'); -- Uses current databaseExemples SQL
Section intitulée « Exemples 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');