Index

摘要

Index 对象包含有关表或要素类的索引的信息。

属性

属性说明数据类型
fields
(只读)

索引的 Field 对象的列表。

Field
isAscending
(只读)

指定索引是否按升序排列。

Boolean
isFullText
(只读)

指定索引是否是全文索引。

Boolean
isUnique
(只读)

指定索引是否是唯一索引。

Boolean
name
(只读)

索引的名称。

String

代码示例

索引示例

显示指定表的索引属性。

import arcpy

feature_class = r"c:\data.gdb\wells"

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

# Iterate through the indexes
for index in indexes:
    # Print index properties
    print(f"Name: {index.name}"
    print("\tAscending index  : {index.isAscending}")
    print("\tUnique index     : {index.isUnique}")
    print("\tFull-text index  : {index.isFullText}")
    print("\tNumber of fields : {len(index.fields)}\n")

相关主题