Skip to main content

ValidateDataStoreItem

汇总

ValidateDataStoreItem 函数可验证文件夹或数据库是否已成功注册至 ArcGIS Server 站点。

语法

ValidateDataStoreItem(connection_file, datastore_type, connection_name)

参数 说明 数据类型

connection_file

The connection file. For a hosting server, provide the server URL or use the MY_HOSTED_SERVICES keyword. For a stand-alone server, use an ArcGIS Server connection file (.ags) representing the server with which you want to register the data.

String

datastore_type

Specifies the type of data that will be validated.

  • DATABASE—Data that resides in an enterprise database will be validated.

  • FOLDER—File-based data will be validated.

String

connection_name

The name of the folder or database being validated that is registered with the ArcGIS Server site.

String

返回值

数据类型 说明

String

如果数据存储项目有效,则返回 valid ;如果无效,则返回 invalid

代码示例

ValidateDataStoreItem 示例

打印在 ArcGIS Server 站点注册的所有文件夹或数据库的有效性。

import arcpy

conn = "GIS Servers/MyConnection.ags"
for store_type in ["FOLDER", "DATABASE"]:
    print(f"Validating data store items of type {store_type}")
    for i in arcpy.ListDataStoreItems(conn, store_type):
        validity = arcpy.ValidateDataStoreItem(conn, store_type, i[0])
        print(f"The data item '{i[0]}' is {validity}")