Index
汇总
Index 对象包含有关表或要素类的索引的信息。
讨论
无法直接创建 Index 对象。 使用 ListIndexes 或 Describe 函数访问 Index 对象。
属性
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
fields (只读) |
索引的 |
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(f"\tAscending index : {index.isAscending}")
print(f"\tUnique index : {index.isUnique}")
print(f"\tFull-text index : {index.isFullText}")
print(f"\tNumber of fields : {len(index.fields)}\n")