List all Indexes within a geodatabase

462
0
05-02-2019 12:19 PM
Brian_McLeer
Occasional Contributor II

My goal is to list all indexes that are being used on each feature class in an SDE database with ~50 feature classes that reside, with the end product being a list of the feature class and what the name of the index is. 

import arcpy

arcpy.env.workspace = r"Database Connections\Server Database Login.sde"

# Get list of indexes and print properties
FCs = arcpy.ListFeatureClasses()
for FC in FCs:
    indexes = arcpy.ListIndexes(FC)
    for index in indexes:
       print FC
       print("Name : {0}".format(index.name))
       print("IsAscending : {0}".format(index.isAscending))
       print("IsUnique : {0}".format(index.isUnique))
Brian
0 Replies