0

I am trying to automate the rebuild of file geodatabase indexes using ArcPy v10.6, but I encounter an ERROR 000837 The workspace is not the correct workspace type.

Question: If arcpy.RebuildIndexes_management() works only with Enterprise geodatabases, then how to rebuild indexes in file geodatabases?

import arcpy, os
workspace = "C:/tmp/myDatabase.gdb"
fc = "MyFeatureClass"
arcpy.Exists(workspace)
>>>True
arcpy.Exists(os.path.join(workspace, fc))
>>>True
arcpy.RebuildIndexes_management(workspace, "NO_SYSTEM", [fc], "ALL")
>>>ERROR 000837 The workspace is not the correct workspace type

.

asked Dec 4, 2019 at 18:13

1 Answer 1

2

That method cannot be used on a file geodatabase, from the tool help document, see usage statement below:

Data must be from a database or an enterprise, workgroup, or desktop geodatabase. This tool does not work with file or personal geodatabases.

To add an index to an existing feature class within a geodatabase you may use the Add Attribute Index or Add Spatial Index method:

answered Dec 4, 2019 at 18:33
5
  • I can't accept your post, because it does not really answer my question Commented Dec 4, 2019 at 20:00
  • 2
    @BelowtheRadar how does this not answer your question? They explain why that tool does not work ( something easily solved if the help file had been researched) and they provide a solution, the add attribute tool. Suggest you explore the section of the help file about the index tools? Commented Dec 4, 2019 at 21:30
  • @Hornbydd because I am asking what is the proper way to rebuild indexes with arcpy inside file geodatabase, not why it's not working with arcpy.RebuildIndexes_management() Commented Dec 4, 2019 at 21:33
  • 2
    The answer above is the only way to build an attribute index for a file geodatabase. Commented Dec 4, 2019 at 21:36
  • I want to rebuild existing indexes, so the answer should be something like, get the indexes infos from the featureClass, drop those indexes and create the indexes again Commented Dec 4, 2019 at 21:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.