I have the following python script...This leaves behind a schema lock on the resulting sde featureclass so the next day it runs, it fails.How, in python, can I clear a schema lockNote: My older code used to do a delete layerthen recreate the layer and no arcpy.env.overwriteoutput=trueand this does not leave behind a schema lock.Something with the overwriteoutput is leaving the lock around...# ---------------------------------------------------------------------------
# gisbuild_layer.py
# Created on: 2011-09-29 11:35:46.00000
# (generated by ArcGIS/ModelBuilder)
# Author: Anastasia Aourik
# Description:
# Regenerate featureclass WG_POMDJOBS from source table with xy values
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy, os, datetime
arcpy.env.overwriteOutput = True
# Local variables:
WCSS_SOURCE = "Database Connections\\OLE DB ConnectionMYDRS0.odc\\WCSS.POMD_JOBREC_MV"
WCSS_Layer = "WCSS_Layer"
SIIGIS_WG_LAYER = "Database Connections\\Connection to sql04.sde\\siiview.SIIGIS.WELLSGENERAL\\siiview.SIIGIS.WG_POMDJOBS"
now = datetime.datetime.now()
print "GisBuild of PATHFINDER JOBS"
print "Started: " + str(now)
try:
if arcpy.Exists(WCSS_SOURCE):
# Process: Make XY Event Layer
print "Source Table Exists"
arcpy.MakeXYEventLayer_management(WCSS_SOURCE, "LONGITUDE_NBR", "LATITUDE_NBR", WCSS_Layer, "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision", "")
print "Make XY Layer Succeeded"
if arcpy.Exists(WCSS_Layer):
print "Proceed to Copy Features"
# Process: Copy Features
print "Begin Copy Features Management"
arcpy.CopyFeatures_management(WCSS_Layer, SIIGIS_WG_LAYER, "", "0", "0", "0")
print "All Features Copied\n"
now = datetime.datetime.now()
print "Ended: " + str(now) + "\n"
except:
arcpy.AddError("Python Messages: " + arcpy.GetMessages())