DeleteRows_management and Append_management problems

387
6
10-03-2017 06:21 AM
MarkBinder
Occasional Contributor

I'm trying to update a layer that is in an Oracle sde feature class. I create the feature class in a file geodatabase and then delete the features in the sde feature class and append the features from the file geodatabase layer.

I was having trouble getting it to work until I switched from a 64-bit IDE to a 32-bit one. Do DeleteRows_management and Append_management only work in a 32-bit environment?

0 Kudos
6 Replies
JoshuaBixby
MVP Esteemed Contributor

Although you posted this in the ArcGIS API for Python‌ place, I am guessing it is an ArcPy question and will get more feedback in the Python‌ space.

Several things could be going on.  What version of ArcGIS Desktop are you running?  Do you have 64-bit Background Geoprocessing installed?  You say the IDE is 64-bit, are you trying to run 32-bit ArcPy or 64-bit ArcPy code?

MarkBinder
Occasional Contributor

Thanks for the posting tip.

I'm using ArcGIS 10.4.1 and have the 64-bit Background Geoprocessing package installed. I have PyScripter 64-bit and 32-bit as my IDEs. I believe that I only have 32-bit ArcPy available to me.

0 Kudos
JamesCrandall
MVP Frequent Contributor

Is it a complete deletion of all features and then append?  If so, perhaps TruncateTable_management is appropriate (I think requires owner account to perform this operation tho). 

Define "trouble getting it to work".  

Any error messages? 

Which lines of code failed?

If it's an enterprise dataset, is it versioned? 

Are you starting/stopping an edit session?   

We were having some issues with SDE updates on non-versioned feature classes (Oracle) and cleared things up by implementing arcpy.ClearWorkspaceCache_management.

0 Kudos
MarkBinder
Occasional Contributor

When I run DeleteRows_management nothing happens if I use the 64-bit IDE but it works with the 32-bit IDE. No error messages, not versioned, no edit session.

I run DeleteRows_management on the sde feature class to clear the existing features and then run Append_management to load the new ones.

0 Kudos
JamesCrandall
MVP Frequent Contributor

I don't know what could be the issue, but I'd think TruncateTable_management would be the better option if you are simply deleting all features/rows and then appending (no recovery of deleted features though!).  Also, be sure to correctly implement arcpy.ClearWorkspaceCache_management since you are working in an enterprise environment and this should help to eliminate connections.

I've not done much with Append and typically rely on arcpy.da cursor to perform appends, updates and deletes.

MarkBinder
Occasional Contributor

I only have one feature in the feature class that I'm deleting so switching to TruncateTable_management might not make any difference. I also create temporary sde connections in my script and then delete them at the end.

0 Kudos