zenben

Schema locks and join problems

Discussion created by zenben on May 15, 2012
Latest reply on Jan 10, 2013 by zenben
I'm writing a script to summarize data in a feature class in two different ways using Statistics_analysis, then join the two generated tables to do some calculations.  The problem is that the join fails due to a schema lock error. If I split the script into two scripts, closing out the geoprocessor after the statistics runs, then it works. But, I really want it all in one script. Anyone know how I can get Statistics_analysis to let go so I can continue my geoprocessing in the same script?

Here is the code:

# Make a table view containing only the impervious surfaces in the allSurfaces FC
arcpy.MakeTableView_management("Surfaces\\allSurfaces", "impsurfaces", """ "Material"= 'concrete' OR "Material" = 'asphalt' OR "Material" = 'wood' OR "Material" = 'rubber' OR "Material" = 'artificial' OR "Material" = 'greenasphalt' OR "Material" = 'blueasphalt' OR "Material" = 'redasphalt' """)


# Make a table view containing all surfaces.
arcpy.MakeTableView_management("Surfaces\\allSurfaces", "surfacetotals")


# Summarize to get total imp surface by property
arcpy.Statistics_analysis("impsurfaces", "Sewer", [["Shape.area", "SUM"]], "Property")
# Summarize to get total park area by property
arcpy.Statistics_analysis("surfacetotals", "Parksizes", [["Shape.area", "SUM"]], "Property")

#join the tables so we can do some calculations.
arcpy.JoinField_management("Sewer", "OBJECTID", "Parksizes", "OBJECTID", "SUM_Shape_area")



by the way, I don't want to join on OBJECTID (for obvious reasons), I want to use 'Property', but when I do only about 10% of the records match even though they were generated from the same feature class using the same Statistics_analysis method, and the entries in the field look IDENTICAL!  Any help on this problem would also be great

Thanks!

Outcomes