https://delta.io logo
g

Georg Heiler

08/10/2023, 7:58 AM
How can I repair a delta table where files were deleted manually?
t

Tom van Bussel

08/10/2023, 1:37 PM
In Spark you can run
Copy code
FSCK REPAIR TABLE table_name [DRY RUN]
This command will remove all references to files that no longer exist from the Delta Log. Adding “DRY RUN” will tell you which files it determined to be missing (but won’t fix anything).
g

Georg Heiler

08/10/2023, 1:39 PM
but this works only with a table. If I do not have a metastore only the delta files in S3?
how can I apply this instead?
t

Tom van Bussel

08/10/2023, 1:40 PM
It will still work. You can refer to non-metastore tables as
Copy code
delta.`uri:/path/to/table`
So
Copy code
FSCK REPAIR TABLE delta.`uri:/path/to/table`
This works for all Delta SQL command (e.g. MERGE).
g

Georg Heiler

08/10/2023, 1:41 PM
ah cool