Skip to main content
Tweeted twitter.com/StackGIS/status/953436952463859718
added 2 characters in body; edited title
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Should I be using Using ArcPy or SQL methods to truncate data from SDEArcSDE 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.

Should I be using ArcPy or SQL methods to truncate data from SDE 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.

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.

Source Link
Erica
  • 9k
  • 4
  • 34
  • 80

Should I be using ArcPy or SQL methods to truncate data from SDE 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.