I am pulling in CSV tables, that are updated frequently, into a file geodatabase. Is there a way to overwrite the old table with the new one?

  • do you want to overwrite the table, or do you want to simply remove all the old data, and replace it with the new data into the existing columns, without removing any security settings that might be applied to that table and would have to be re-assigned... – DPSSpatial Dec 20 '18 at 22:08
  • Whichever is cleanest. The kicker is that the new tables will frequently be longer. When I was doing this with shapefiles I created a temporary folder than moved them to the folder linked to the map file. Does that answer your question? – NSD Dec 20 '18 at 22:23
  • Truncate Table and Append tools will empty and fill an existing table (with the option to match fields between different schemas using the No Test option) without the need for an exclusive lock, while the Delete tool and Copy Features tool or Feature Class to Feature Class tool will destroy the entire feature class and replace it with an entirely new one, provided the tools can gain an exclusive lock to the feature class. Security, Indexing, field renaming, etc. set up would not be needed for the first option, but is potentially needed for the second. Performance may be the real difference. – Richard Fairhurst Dec 20 '18 at 22:26
  • @NSD - see the comment from Richard below... – DPSSpatial Dec 20 '18 at 23:07
  • Which one is Richard's? That isn't one of the names or initials. – NSD Dec 21 '18 at 12:59

If you prefer to use tools from the toolbox, try Delete Rows or Truncate Table followed by Append. This will delete all rows from your existing table and then append the new data to the empty table.

Code example:

import arcpy

new_tab = r'C:\TEMP\Default.gdb\test_append'
tab = r'C:\TEMP\Default.gdb\test'


  • This would be an obscenely expensive way to delete rows. Truncate Table is nearly instantaneous (though it requires a lock). If the differences are trivial, I've calculated deltas (as insert, update, and delete ops) in order to limit downtime. A true RDBMS would be needed for high availability and transactional stability. – Vince Dec 21 '18 at 0:08
  • Hmm, I really am a newbie. These suggestions above look very interesting, but I am not sure I really understand them. Perhaps the simplest would be to work around it and add a date or timestamp to the new imports, then periodically delete the old ones? – NSD Dec 21 '18 at 13:02
  • check my edits to my answer @NSD – jbalk Dec 21 '18 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.