Compare the feature count between features in SDE

219
2
05-24-2012 06:29 AM
NishiChauhan-Patel
New Contributor
Any help with the follow Python Script would be great!

I'm trying to compare the feature count between features in production SDE and development SDE. So far I have got the following attached, which works but I have the loop in the wrong place, so the comparison at the end compares all DEV features against the first PROD features.

Thanks in advance,
Nish
Tags (2)
0 Kudos
2 Replies
MathewCoyle
Frequent Contributor
I have run this exact procedure before. Except it was between two FGDB.

Hopefully it translates for you.
import arcpy, os

sde1 = r"D:\sde_transit\sde1.gdb"
output = r"D:\sde_transit\sdeCSRS.gdb"

arcpy.env.workspace = sde1
sdeList = arcpy.ListFeatureClasses()

for fc in sdeList:
    
    result = arcpy.GetCount_management(fc)
    count1 = result.getOutput(0)

    fc2 = os.path.join(output,fc)
    if arcpy.Exists(fc2):
        result = arcpy.GetCount_management(fc2)
        count2 = result.getOutput(0)
        if count1 == count2:
            print fc+" OK"

        else:
            print "Problem with "+fc
            print count1
            print count2
    else:
        print fc2+" not found"
        pass

# Clean up
sdeList = None
del arcpy.env.workspace
del arcpy
0 Kudos
NishiChauhan-Patel
New Contributor
Mathew,

Thanks very much, worked really well, just needed to adapt it a little!

Cheers,
Nish
0 Kudos