Skip to main content
2 of 2
added 2 characters in body; edited title
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Using ArcPy or SQL methods to truncate data from ArcSDE feature classes and tables?

There are a handful of ArcPy methods for truncating data in a table. It's also possible to do a direct SQL command to truncate a table (e.g. TRUNCATE TABLE DBO.VALVES) via a Python library (e.g. cx_Oracle or pyodbc).

What are advantages or disadvantages to ArcPy methods over SQL alternatives?

Do these considerations change when data is versioned or not?

If it's relevant, right now we're working with Python 2.7 and database 10.2.1; we're transitioning to Python 3 and database 10.6+ sometime in the next year.

Note: For the purposes of this question, the ability of Delete Rows to work on a subset is not relevant — we're interested in completely emptying the table to repopulate with data, and debating what method(s) would be best to standardize on.

Erica
  • 9k
  • 4
  • 34
  • 80