I have a SDE DB which consists of 40 feature datasets and around 300 featureclasses. I need to get the full list of all featureclasses whose name does not contain "ARCHIVE". It takes several minutes using the script below. It will be unacceptable if I publish this as a geoprocessing service. How can this be improved?
import arcpy,os
import json
from arcpy import env
env.workspace=r"C:\ysde\lcimrl.sde"
arcpy.AddMessage("--------get resource dataset \n")
resourceFeatureList=[]
lodFeatureList=[]
dsList = arcpy.ListDatasets("*","Feature")
for ds in dsList:
dsDesc = arcpy.Describe(ds)
dsName=dsDesc.name.upper()
arcpy.AddMessage("--------get feature class list from "+dsName+" \n")
fcList = arcpy.ListFeatureClasses("*","",ds)
print fcList
for fc in fcList:
desc = arcpy.Describe(fc)
fcName=desc.name.upper()
#print dsName+"_"+fcName
if "ARCHIVE" not in fcName:
if dsName!="SDE.ALTERNATIVES":
resourceFeatureList.append(fc)
else:
lodFeatureList.append(fc)
print resourceFeatureList
print lodFeatureList