Sub topic 11
Reloading already-loaded files with force
This chapter covers the force copy option. It explains when to use it and what it does to your data. It assumes you can write a basic COPY INTO statement and know how Delta tables work. You should also know that COPY INTO tracks the files it has loaded, which the idempotency chapter covers.
Why COPY INTO skips files
COPY INTO records the files it loads into a target table. On the next run it compares the files in the source location against that record and loads only the new ones. This is why re-running a statement is safe.
Sometimes you want the opposite. You may have fixed a bug in a SELECT transformation, changed a format option, or truncated the table and need to rebuild it from the same files. In those cases the tracking works against you, because COPY INTO reports zero rows loaded for files it considers done.
Setting force
Set force to true in COPY_OPTIONS. COPY INTO then ignores its record of loaded files and loads every file that matches the source and any PATTERN or FILES filter.
COPY INTO main.sales.orders
FROM '/Volumes/main/sales/landing/orders/'
FILEFORMAT = CSV
FORMAT_OPTIONS ('header' = 'true')
COPY_OPTIONS ('force' = 'true');The default is false. The option applies only to the statement that sets it. The next statement without force goes back to skipping files, and it treats the files you just reloaded as loaded.
What force does to your data
force does not replace or update existing rows. It appends. If the table already holds rows from 2026-12-01.csv and you reload that file with force, the table now holds two copies of those rows.
Safe reload patterns
Three patterns cover most cases.
- Rebuild the whole table. Empty the table, then reload everything with
force. - Reload a subset. Delete the rows that came from the affected files, then reload only those files by combining
forcewithPATTERNorFILES. - Reload into a new table. Create a fresh table and run
COPY INTOwithoutforce. A new table has no load record, so every file is treated as new.
The first pattern looks like this:
TRUNCATE TABLE main.sales.orders;
COPY INTO main.sales.orders
FROM '/Volumes/main/sales/landing/orders/'
FILEFORMAT = CSV
FORMAT_OPTIONS ('header' = 'true')
COPY_OPTIONS ('force' = 'true');For the second pattern, scoping the reload to one file keeps the blast radius small. If your table records the source file with _metadata.file_path, you can delete by that column first:
DELETE FROM main.sales.orders
WHERE source_file LIKE '%2026-12-01.csv';
COPY INTO main.sales.orders
FROM '/Volumes/main/sales/landing/orders/'
FILEFORMAT = CSV
PATTERN = '2026-12-01.csv'
FORMAT_OPTIONS ('header' = 'true')
COPY_OPTIONS ('force' = 'true');This only works if the table has a source_file column. Adding file metadata during the load, as shown in the SELECT chapter, makes targeted reloads much easier.
Common errors
- Forgetting force is a one-time override. Leaving
'force' = 'true'in a scheduled job reloads every file on every run. Row counts grow each time. Remove the option once the repair is done. - Reloading without cleaning up. Duplicates are the usual result. Check with a count grouped by source file or a business key.
- Expecting force to fix a failed run. If a run failed before committing, the files were not recorded as loaded, so a normal re-run picks them up. You do not need
forcethere. - Using force to detect changed files.
COPY INTOdoes not reload a file because its contents changed. Overwriting a file under the same name does not make it new.forceis the usual way to pick up such a file, and the duplicate warning above applies.
Run VALIDATE first when you are unsure. It previews the rows without writing them, which helps when you are about to run a forced reload.
Exercise
A table holds rows loaded from 2026-12-01.csv. You fix a casting bug in your SELECT source and rerun the same COPY INTO with 'force' = 'true' and PATTERN = '2026-12-01.csv', without any other step. What happens to the table, and what should you do first?
Show answer
The file's rows are appended again, so the table holds two copies, one with the old casting and one with the new. Before the forced run, delete the rows that came from that file (for example by filtering on a source_file column), then run the forced load. Remove the force option from the statement afterward.
Exercise
A scheduled job runs COPY INTO every hour and someone left 'force' = 'true' in the statement. What symptom do you see in the target table?
Show answer
Each run reloads all matching files, so the row count grows by the full source size every hour and duplicates accumulate. The fix is to remove force, then deduplicate or rebuild the table.