Index

摘要

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

fc = "C:/Data/well.shp"

# Create a list of indexes using the ListIndexes function
#
indexList = arcpy.ListIndexes(fc)

# Iterate through the list of indexes
#
for index in indexList:
    # Print index properties
    #
    print "Name: " + index.name
    print "\tType            : " + index.isAscending
    print "\tScale           : " + index.isUnique
    print "\tNumber of fields: " + str(len(index.fields))

相关主题


7/10/2012