Remove all attribute indexes using arcpy

2263
1
07-02-2012 04:43 AM
EricVenden
Occasional Contributor II
Is there a way to remove all attribute indexes on a particular feature class using python- without naming each one specifically?
I have a script that I can run, but it names each index separately.  I would like to remove all indexes with one command if possible.
Thank you
Eric V
Tags (2)
0 Kudos
1 Reply
KimOllivier
Occasional Contributor III
Create a list of indexes for a table using Describe and then delete them using the geoprocessing tool.
Since you can supply a list, then that is done in one step. Ignore the first index on the objectid.
arcpy.env.workspace = "e:/crs/mobile/mobile.gdb"
dsc = arcpy.Describe("sap")
lstIndex = [i.name for i in dsc.Indexes][1:]
print lstIndex
arcpy.management.RemoveIndex("sap",lstIndex)
0 Kudos