Gp.CopyFeatures_management and Locks

840
3
04-18-2012 06:45 AM
JaysonLindahl
Occasional Contributor
So I have data that needs to be refreshed often.  I'm using python scripts to make my updates.  I'm trying to figure out the best way to manage the updates of data and possible locking conflicts that can occur.  I have a sript that uses the Gp.CopyFeatures_management geoprocessing tool and was wondering if a locks is established, will it still update the data or fail?
0 Kudos
3 Replies
MarcinGasior
Occasional Contributor III
Mayby I misunderstood your question, but CopyFeatures tool doesn't update existing feature class - it creates a new one.

If you want to update existing feature class you can use UpdateCursor.
Here's very informative page about Cursors and Locking
0 Kudos
JaysonLindahl
Occasional Contributor
Yes, this tool can be used to create new feature classes, but it can also be used to update the entire feature class.
If the output feature class already exists, it will be overwritten.

I'm wondering what is going on in the background during the overwrite process.  Is the feature class being dropped, then recreated?  Would a shared lock affect it?
0 Kudos
MathewCoyle
Frequent Contributor
The output would be a new feature class. If the tool output has the same path/name as an existing feature class, that original feature class will first be deleted, then the new one created.

In terms of locks, if the original feature class is locked somewhere the process will fail.
0 Kudos