Categories:

Information Schema , Table functions

VALIDATE_PIPE_LOAD

This table function can be used to validate data files processed by Snowpipe within a specified time range. The function returns details about any errors encountered during an attempted data load into Snowflake tables.

Note

This function returns pipe activity within the last 14 days.

Syntax

VALIDATE_PIPE_LOAD(
      PIPE_NAME => '<string>'
       , START_TIME => <constant_expr>
      [, END_TIME => <constant_expr> ] )

Arguments

PIPE_NAME => string

A string specifying a pipe. The function returns results for the specified pipe only.

START_TIME => constant_expr

Timestamp (in TIMESTAMP_LTZ format), within the last 14 days, marking the start of the time range for retrieving error events.

Optional:

END_TIME => constant_expr

Timestamp (in TIMESTAMP_LTZ format), within the last 14 days, marking the end of the time range for retrieving error events.

Usage notes

  • Returns results only for the pipe owner (i.e. the role with the OWNERSHIP privilege on the pipe) or a role with the following minimum permissions:

    PrivilegeObjectNotes
    MONITORPipeAlternatively, the global MONITOR EXECUTION privilege is supported.
    USAGEStage in the pipe definitionExternal stages only
    READStage in the pipe definitionInternal stages only
    SELECTTable in the pipe definition
    INSERTTable in the pipe definition
    SQL operations on schema objects also require the USAGE privilege on the database and schema that contain the object.
  • When calling an Information Schema table function, the session must have an INFORMATION_SCHEMA schema in use or the function name must be fully-qualified. For more details, see Snowflake Information Schema.

  • If Snowpipe encountered no errors while processing data files within the specified time range, the function returns no results.

  • If the COPY statement in the pipe description includes a query to further transform the data during the load (i.e. a COPY transformation), then the function currently returns a user error.

  • If the specified date range falls outside the last 15 days, an error is returned.

Output

The function returns the following columns:

Column NameData TypeDescription
ERRORTEXTFirst error in the source file.
FILETEXTName of the source file where the error was encountered.
LINENUMBERNumber of the line in the source file where the error was encountered.
CHARACTERNUMBERPosition of the character where the error was encountered.
BYTE_OFFSETNUMBERByte offset to the character where the error was encountered.
CATEGORYTEXTCategory of the operation when the error was produced.
CODENUMBERID for the error message displayed in the ERROR column.
SQL_STATENUMBERSQL state code.
COLUMN_NAMETEXTName and order of the column that contained the error.
ROW_NUMBERNUMBERNumber of the row in the source file where the error was encountered.
ROW_START_LINENUMBERNumber of the first line of the row where the error was encountered.
REJECTED_RECORDTEXTRecord that contained the error.

Examples

Validate any loads for the mypipe pipe within the previous hour:

select * from table(validate_pipe_load(
  pipe_name=>'MY_DB.PUBLIC.MYPIPE',
  start_time=>dateadd(hour, -1, current_timestamp())));