rebuild_indexes_analyze

RPLib – rebuild_indexes_analyze

RPLib.rebuild_indexes_analyze(Workspace=None, excludeList=None, include_system=False, delta_only=True, only_versioned=True, analyze_base=True, analyze_delta=True, analyze_archive=True)[source]

Updates indexes of datasets and system tables stored in an enterprise geodatabase. Rebuilds existing attribute or spatial indexes. Updates database statistics of base tables, delta tables, and archive tables, along with the statistics on those tables indexes.

Parameter Type Description Required
Workspace String Path to SDE connection file Yes
excludeList List List of object names to exclude from being processed. No
include_system Boolean

Indicates whether statistics will be gathered on the states and state lineages tables.

  • True = SYSTEM
  • False = NO_SYSTEM (Default)
No
delta_only Boolean

Indicates how the indexes will be rebuilt on the selected datasets.

  • True = ONLY_DELTAS (Default)
  • False = ALL
No
only_versioned Boolean

Indicates if indexes will only be rebuilt for objects that are versioned.

  • True = Include only versioned objects. (Default)
  • False = Include all database objects versioned and non-versioned.
No
analyze_base Boolean

Indicates whether the selected dataset base tables will be analyzed.

  • True = ANALYZE_BASE (Default)
  • False = NO_ANALYZE_BASE
No
analyze_delta Boolean

Indicates whether the selected dataset delta tables will be analyzed.

  • True = ANALYZE_DELTA (Default)
  • False = NO_ANALYZE_DELTA
No
analyze_archive Boolean

Indicates whether the selected dataset delta tables will be analyzed.

  • True = ANALYZE_ARCHIVE (Default)
  • False = NO_ANALYZE_ARCHIVE
No

Returns: Boolean

Usage

  • Only works with enterprise geodatabases.
  • After data loading, deleting, updating, and compressing operations, it is important to rebuild indexes and update statistics in the database.

Example 1

Simple call with all parameters specified.

import RPLib

dataOwner = "C:/GIS/GISADMIN@GIS.sde"
# Exlude tables that have the below variations in their name from the process.
# Views will typically throw errors with this tool.
excludeList = ['VW_', '_VW', 'V_', '_V',]

RPLib.rebuild_indexes_analyze(dataOwner, excludeList, False, True, False, True, True, True)

Example 2

Simple call with only required parameters specified.

import RPLib

dataOwner = "C:/GIS/GISADMIN@GIS.sde"

RPLib.rebuild_indexes_analyze(dataOwner)

Example 3

If Else logic with all parameters specified.

import RPLib

dataOwner = "C:/GIS/GISADMIN@GIS.sde"
# Exlude tables that have the below variations in their name from the process.
# Views will typically throw errors with this tool.
excludeList = ['VW_', '_VW', 'V_', '_V',]

if RPLib.rebuild_indexes_analyze(dataOwner, excludeList, False, True, False, True, True, True):
    print("successful, run another tool")
else:
    print("failed, run another tool")

Example 4

Notice you do not need to specify these parameters because by default:
  • excludeList = Is an empty list by default

  • include_system = False
    • You must be the geodatabase administrator for this option to be True.
  • delta_only = True

  • analyze_base = True

  • analyze_delta = True

  • analyze_archive = True

  • include_system = True

import RPLib

dataOwner = "C:/GIS/GISADMIN@GIS.sde"

if RPLib.rebuild_indexes_analyze(dataOwner):
    print("successful, run another tool")
else:
    print("failed, run another tool")

Table Of Contents

Previous topic

createversions

Next topic

reconcilepost

This Page