reference_audit()
relationalai.app
reference_audit()A procedure that returns all object references currently registered with the application, along with their classification as ACTIVE or UNUSED.
Use this procedure to identify data stream source references that are no longer in use before running app.cleanup_unused_data_stream_references().
Requires the rai_user application role.
Parameters
Section titled “Parameters”None.
Returns
Section titled “Returns”A table with the following columns:
| Column | Type | Description |
|---|---|---|
REFERENCE_NAME | STRING | The type of reference. One of DATA_STREAM_TABLE, DATA_STREAM_VIEW, IMPORT_TABLE, or IMPORT_VIEW. |
REFERENCE_ALIAS | STRING | The internal alias that identifies this reference within the application. |
FQ_OBJECT_NAME | STRING | The fully qualified name of the Snowflake table or view the reference points to. |
REFERENCE_CREATED_AT | TIMESTAMP | The time the reference was registered. |
CLASSIFICATION | STRING | ACTIVE if the reference is associated with at least one active data stream. UNUSED if no data stream points to it or all associated streams are being deleted. NULL for IMPORT_* references. |
DATA_STREAM_STATUS | STRING | The status of the associated data stream, if any. NULL if the reference has no associated stream. |
LAST_ACTIVITY_AT | TIMESTAMP | The most recent activity time for the associated data stream. NULL if there is no associated stream. |
Example
Section titled “Example”Use app.reference_audit() to list all registered references and identify which are unused:
CALL relationalai.app.reference_audit();Rows where CLASSIFICATION is UNUSED can be safely removed with app.cleanup_unused_data_stream_references().