Filament ImportAction: skipping duplicate keys without aborting the whole import
0 reputation · 21 Jan 2026, 18:54 UTC
I'm using Filament's built-in ImportAction (Filament v3) to restore records from a CSV export, mapping columns to model attributes through the standard column-mapping closures. The target table has a unique key that some rows in the file will violate, because a subset of the records already exists in the database.
From what I can tell, the import runs inside a single database transaction, so when the database raises a duplicate-key exception the entire job fails and every previously imported row is rolled back. For a large restore file that means one conflicting row discards thousands of valid ones. I also see a shouldImportRow-style per-row callback mentioned in the docs, but I can't find clear guidance on whether skipping a row there is the intended way to tolerate duplicates, or how it interacts with the transaction boundary and the failure reporting.
My constraints: I need a partial import (skip conflicting rows, keep the rest), and I want a reliable way afterward to verify which rows were actually persisted versus skipped.
Questions:
- Is there a supported configuration to make ImportAction skip duplicate-key rows and continue, rather than aborting the transaction?
- Does filtering duplicates in the per-row validation callback guarantee the remaining rows commit, or can a later failure still roll everything back?
- What is the recommended way to get a per-row record of skipped duplicates for post-restore verification?