Select to view content in your preferred language

RebuildIndexes

295
2
a month ago
ForrestLin
Frequent Contributor

I run the following python script code in Notebook in ArcGIS Pro. It works.

arcpy.management.RebuildIndexes(input_database=database,include_system="NO_SYSTEM",in_datasets=dataset,delta_only="ALL")
 
But I run it in VS code:
 
import arcpy
arcpy.management.RebuildIndexes(input_database=database,include_system="NO_SYSTEM",in_datasets=dataset,delta_only="ALL")
 
I get error:
 
Failed to execute. Parameters are not valid.
ERROR 000837: The workspace is not the correct workspace type.
Failed to execute (RebuildIndexes).
 
0 Kudos
2 Replies
KenGalliher1
Esri Contributor

What are you passing in as the input_database argument? It should be an .sde file connected with a user that is able to rebuild indexes.

Rebuild Indexes (Data Management)—ArcGIS Pro | Documentation

0 Kudos
ForrestLin
Frequent Contributor

@KenGalliher1 

Yes, I pass a .sde file in as the input_database argument.

The following code are same  running in Notebook in ArcGIS Pro and VS code.

arcpy.management.RebuildIndexes(input_database=database,include_system="NO_SYSTEM",in_datasets=dataset,delta_only="ALL")

Added import arcpy in VS code.

Thank you!

Forrest

0 Kudos