Monday, July 18, 2011

Testing for Schema Locks

TestingSchemaLock tests if a feature class or table has a schema lock.  Any tool that alters schema will require a schema lock to be placed on the input data.  If a tool requires a schema lock and is unable to acquire one an error message is provided.

import arcpy
data = arcpy.GetParameterAsText(0)
isLocked = arcpy.TextSchemaLock(data)
if lockTest:
   print "Unable to acquire the necessary schema lock to add the new field"