概要
The Index object contains information about an index on a table. There are two types of indexes: spatial and attribute. Spatial indexes exist on the shape field of a feature class.
ディスカッション
Index objects cannot be created directly. Index objects can accessed through the ListIndexes and Describe functions.
プロパティ
プロパティ | 説明 | データ タイプ |
fields (読み取り専用) | A Python List of field objects for the index. | Field |
isAscending (読み取り専用) | The isAscending state: True if the index is sorted in ascending order. | Boolean |
isUnique (読み取り専用) | The isUnique state: True if the index is unique. | Boolean |
name (読み取り専用) | The name of the index. | String |
コードのサンプル
Index example
Display index properties for specified table.
import arcpy
feature_class = "c:/data/well.shp"
# Create a list of indexes using the ListIndexes function
indexes = arcpy.ListIndexes(feature_class)
# Iterate through the list of indexes
for index in indexes:
# Print index properties
print("Name: {0}".format(index.name))
print("\tType : {0}".format(index.isAscending))
print("\tScale : {0}".format(index.isUnique))
print("\tNumber of fields: {0}".format(len(index.fields)))