Select to view content in your preferred language

schema locks with fGDB and python

1125
2
Jump to solution
02-19-2013 10:06 AM
BKS
by
Occasional Contributor
Just wondering if anyone else has experienced the same as myself and if you have any thoughts/ideas.

I run a python script in a CMD shell running Windows 7 (ArcGIS 10.1). 

The script sets the workspace to...    arcpy.env.workspace = arcpy.env.scratchGDB

I copy a table from a given file GDB into the scratchGDB which is another file GDB.

I then attempt to add about 13 fields to the copied table in the scratchGDB.

This is the strange part.  Often this will work but other times it fails indicating that it could get the schema lock necessary to add the a field.

If I didn't know better it almost seems like it's getting ahead of itself whilst looping and trying to get a schema lock before it's finished adding the previous field.

I do not have ArcGIS desktop running, and there does not seem to be any lock files in the scratchGDB prior to executing.

Other times it seems to fail while attempting to delete a table or FC from the scratchGDB.  Same issue.  Can't get the schema lock.  Yet most of the time it works just fine when deleting tables/FC from the scratchGDB. 

Thus far, using python has been a good experience except for the schema lock issues.   it seems inconsistent and unpredictable.

Any suggestions or similar experiences welcome.

brian
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MathewCoyle
Frequent Contributor
0 Kudos
2 Replies
MathewCoyle
Frequent Contributor
0 Kudos
Brian_Wilson
Regular Contributor II

The problem still exists but the URLs given in the "solution" no longer exist.

In my case I am trying to DELETE fields, not create them. I also tried using FeatureClassToFeatureClass with a field map. Same result. The target feature class ends up schema locked, it's in a FGDB not a SQL database, and the only way to recover seems to be to quit the Python script, launch Pro, and delete it in Catalog.

The only work around I have found so far is to delete one field at a time, which is slow!

0 Kudos