Categories:

System Functions (System Information)



## Arguments¶

external_table_name

External table for which you want to retrieve the current automatic refresh status.

## Usage Notes¶

• This function only returns results for the external table owner (i.e. the role that has the OWNERSHIP privilege on the external table).

• external_table_name is a string so it must be enclosed in single quotes:

• Note that the entire name must be enclosed in single quotes, including the database and schema (if the name is fully-qualified), i.e. '<db>.<schema>.<external_table_name>'.

• If the external table name is case-sensitive or includes any special characters or spaces, double quotes are required to process the case/characters. The double quotes must be enclosed within the single quotes, i.e. '"<pipe_name>"'.

## Output¶

The function returns a JSON object containing the following name/value pairs (if applicable to the current pipe status):

Where:

executionState

Current execution state of the pipe; could be any one of the following:

• RUNNING (i.e. everything is normal; Snowflake may or may not be actively processing files for this pipe)

• STOPPED_FEATURE_DISABLED

• STOPPED_STAGE_DROPPED

• STOPPED_FILE_FORMAT_DROPPED

• STOPPED_MISSING_PIPE

• STOPPED_MISSING_TABLE

• STALLED_COMPILATION_ERROR

• STALLED_INITIALIZATION_ERROR

• STALLED_EXECUTION_ERROR

• STALLED_INTERNAL_ERROR

• PAUSED

• PAUSED_BY_SNOWFLAKE_ADMIN

• PAUSED_BY_ACCOUNT_ADMIN

oldestFileTimestamp

Earliest timestamp among data files currently queued (if applicable), where the timestamp is set when the file is added to the queue.

pendingFileCount

Number of files currently being processed by the pipe. If the pipe is paused, this value will decrease as any files queued before the pipe was paused are processed. When this value is 0, either there are no files queued for this pipe or the pipe is effectively paused.

notificationChannelName

Amazon SQS queue or Microsoft Azure storage queue associated with the pipe.

numOutstandingMessagesOnChannel

Number of messages in the queue that have been queued but not received yet.

lastReceivedMessageTimestamp

Timestamp of the last message received from the queue.

lastForwardedMessageTimestamp

Timestamp of the last event message that was forwarded to the pipe.

error

Error message produced when the pipe was last compiled for execution (if applicable).

fault

Most recent internal Snowflake process error (if applicable). Used primarily by Snowflake for debugging purposes.

## Examples¶

Retrieve the automatic refresh status for an external table with a case-insensitive name:

SELECT SYSTEM$EXTERNAL_TABLE_PIPE_STATUS('mydb.myschema.exttable'); +---------------------------------------------------------------+ | SYSTEM$EXTERNAL_TABLE_PIPE_STATUS('MYDB.MYSCHEMA.EXTTABLE')   |
|---------------------------------------------------------------|
| {"executionState":"RUNNING","pendingFileCount":0}             |
+---------------------------------------------------------------+


Retrieve the status for a pipe with a case-sensitive name:

SELECT SYSTEM$EXTERNAL_TABLE_PIPE_STATUS('mydb.myschema."extTable"'); +---------------------------------------------------------------+ | SYSTEM$EXTERNAL_TABLE_PIPE_STATUS('MYDB.MYSCHEMA."extTable"') |
|---------------------------------------------------------------|
| {"executionState":"RUNNING","pendingFileCount":0}             |
+---------------------------------------------------------------+