liveBook · Manning

Copy_history

As explained in Snowflake Data Engineering

COPY_HISTORY is a Snowflake table function that returns loading history for table data loaded by COPY operations.

COPY_HISTORY is a Snowflake table function for monitoring data loaded into a table by bulk COPY commands or Snowpipe. It supports ingestion troubleshooting by exposing load-level operational details. section 5.3.3

Use the returned history to inspect:

  • Source filename and external stage location. section 5.3.3
  • Last load time, row count, and file size. section 5.3.3
  • Error messages and pipe information when Snowpipe executes the COPY command. section 5.3.3

Review the last hour of loads

Query INFORMATION_SCHEMA.COPY_HISTORY for SPEEDY_ORDERS_RAW_STG and restrict results with a one-hour start-time window. section 5.3.3

select *
from table(information_schema.copy_history(
  table_name => 'SPEEDY_ORDERS_RAW_STG', 
  start_time => dateadd(hours, -1, current_timestamp())));

Run the supplied SQL listing to retrieve loading history for the staging table. section 5.3.3

How Snowflake Data Engineering covers it

How deep it goes
Reports filenames, locations, timestamps, counts, sizes, errors, and pipe details within a specified time window.
Examples
Uses SPEEDY_ORDERS_RAW_STG and a one-hour INFORMATION_SCHEMA.COPY_HISTORY query as the concrete monitoring example.
What you can do after
Diagnose recent table loads by querying loading metadata, errors, and Snowpipe execution information.
How it connects
Connects COPY_HISTORY with COPY commands, Snowpipe, pipe objects, and system$pipe_status for ingestion operations.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Snowflake Data Engineering. The section links point to the parts of the book it draws on.