Load history, retries and safe file cleanup
Snowflake tracks loaded files for each table. This helps retries, but it does not enforce business-key uniqueness.
Understand the idea
Bulk load metadata expires after 64 days. Older files can have uncertain load status; LOAD_UNCERTAIN_FILES and FORCE must be deliberate recovery choices. Do not recreate or truncate a destination just to bypass a skip.
| Concept | What it means |
|---|---|
| Same file, same table | Normally skipped after a successful load while metadata is available. |
| FORCE=TRUE | Bypasses the file-load check; can duplicate rows. |
| LOAD_HISTORY | Bulk COPY history in Information Schema, last 14 days. |
| COPY_HISTORY | Information Schema function includes COPY and Snowpipe, last 14 days. |
| PURGE=TRUE | Attempts to remove successfully loaded staged files. |
A concrete example
Replaying orders.csv may insert nothing; delivering the same orders under a new filename can still duplicate them.
Remember: Preserve original files until reconciliation and retention requirements are satisfied.
Explain it step by step · full theory
How to apply it
Bulk load metadata expires after 64 days. Older files can have uncertain load status; LOAD_UNCERTAIN_FILES and FORCE must be deliberate recovery choices. Do not recreate or truncate a destination just to bypass a skip.
For failures, inspect query status, file format, path, role access, row conversion and source counts in that order. PURGE is not a backup strategy, and failed purging may not fail the load. Confirm remaining files with LIST. Longer history is available through Account Usage views with latency and access requirements.
Words used in this lesson
- Same file, same table
- Normally skipped after a successful load while metadata is available.
- FORCE=TRUE
- Bypasses the file-load check; can duplicate rows.
- LOAD_HISTORY
- Bulk COPY history in Information Schema, last 14 days.
- COPY_HISTORY
- Information Schema function includes COPY and Snowpipe, last 14 days.
- PURGE=TRUE
- Attempts to remove successfully loaded staged files.
See how it works
Choose a step to explore the idea at your own pace.
Open the interactive explanation
Load history, retries and safe file cleanup
Understand the input
Snowflake tracks loaded files for each table. This helps retries, but it does not enforce business-key uniqueness.
Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.
Read the complete diagram explanation
- Understand the input
Snowflake tracks loaded files for each table. This helps retries, but it does not enforce business-key uniqueness.
- Follow the example
Replaying orders.csv may insert nothing; delivering the same orders under a new filename can still duplicate them.
- Check the outcome
Preserve original files until reconciliation and retention requirements are satisfied.
Try the SQL or command
Read → predict → run in your learning environment → compare. You can also learn by reading without an account.
New to SQL? Where to run it and how to read it
A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.
- No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
- For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
- Read the entire example, including comments beginning with
--. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor. - Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
- SELECT / FROM
- Choose the values to return / identify their input.
- VALUES / COLUMN1
- VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
- AS / WITH
- AS gives a result a readable name. WITH names a temporary query step within one statement.
- NULL / ::
- NULL means missing or unknown. The :: notation converts a value to a named data type.
- Session
- One connection and its settings. Keep related transaction steps in the same session.
- Database.schema.table
- A full address for stored data. It is separate from the warehouse that processes queries.
Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →
Help with common practice errors
- No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
- Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
- Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
- Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.
Before running this lesson
Manual examples only. Start with this module’s first lesson to create L2_OBJECTS_LAB.M6_LAB. In each new SQL session select that schema and an authorized warehouse. Later lessons state additional prerequisites. Upload file contents through Snowsight or a supported client; never run CSV as SQL.
Inspect recent evidence and retry
SELECT * FROM L2_OBJECTS_LAB.INFORMATION_SCHEMA.LOAD_HISTORY
WHERE SCHEMA_NAME='M6_LAB' AND TABLE_NAME='M6_ORDERS'
ORDER BY LAST_LOAD_TIME DESC;
SELECT * FROM TABLE(L2_OBJECTS_LAB.INFORMATION_SCHEMA.COPY_HISTORY(
TABLE_NAME=>'L2_OBJECTS_LAB.M6_LAB.M6_ORDERS',
START_TIME=>DATEADD('hour', -24, CURRENT_TIMESTAMP())));
COPY INTO M6_ORDERS FROM @M6_FILES/base/
FILES=('orders.csv') FILE_FORMAT=(FORMAT_NAME='M6_CSV');
SELECT COUNT(*) FROM M6_ORDERS;What to expect and why
After lesson 1, an unchanged retry should leave the count at 2. Views depend on your privileges and the actual load time. Keep PURGE off in this lab so later lessons can reuse files.
Check your understanding
Choose an answer, then check your reasoning. This is practice, not a scored test.
Try it yourself
A retry says no files processed. What should you inspect before forcing it?
Compare your reasoning
Check the selected path, pattern, previous COPY status and destination counts. FORCE is not a generic error fix.
Official sources and curriculum
Module 06 · See module scope