Hi,
We are using arcpy.Append_management to import shape files into existing tables in an Oracle database. For some reason Append_management automatically creates a spatial index after the append. We don't want this behaviour. How can we disable the automagical creation of a spatial index?
Thanks,
Rob
Solved! Go to Solution.
Thanks Neil!
For me as an Oracle developer, the automatic creation of the spatial index is not a feature but a bug
Your reply has triggered me to look at the arcpy.env settings and initial test show that maintainSpatialIndex does the trick
arcpy.env.maintainSpatialIndex = True
It's a bit counter-intuitive, but it looks like arcpy.env.maintainSpatialIndex = True actually means: leave the spatial index status unchanged and if none exists, don't create one.
Regards,
Rob
Well the creation of the spatial index is a feature of the geodb.
You can create a very long list of inputs and have them all appended together, that way the spatial index is calculated only once at the end.
If you append them invidually, each time append runs the spatial index will be recalculated, which does increase processing time.
Perhaps you can mess with the spatialGrid1, 2, 3 in the arcpy.env settings. Set them all to 0 and see what happens.
Thanks Neil!
For me as an Oracle developer, the automatic creation of the spatial index is not a feature but a bug
Your reply has triggered me to look at the arcpy.env settings and initial test show that maintainSpatialIndex does the trick
arcpy.env.maintainSpatialIndex = True
It's a bit counter-intuitive, but it looks like arcpy.env.maintainSpatialIndex = True actually means: leave the spatial index status unchanged and if none exists, don't create one.
Regards,
Rob
Ausome post Neil's,
Been struggling to find a solution to this, especially when the feature class turns to million rows, the append goes on for ever on postgre DB.
But, after this environment setting, it just takes minutes.
However, i have a question to you.
Do i need to rebuild the spatial index regularly or will the postgre DB take care of this?
I know that, i am asking a postgre DB related question, but this might be applicable for others as well.
Regards
Sandeep