shsmi_sysdb_nex/test/test_arcpy.py

31 lines
862 B
Python
Raw Normal View History

# coding=utf-8
import arcpy
from functions import *
# Set the workspace
arcpy.env.workspace = u"C:\\Users\\Administrator\\PycharmProjects\\shsmi_sysdb_nex\\源库SDE连接\\shdlg500.sde"
# Get the list of the feature classes in the workspace
# fc_list = arcpy.ListFeatureClasses()
# # 循环验证每个fc是否为有效的sde创建的fc
# for fc in fc_list:
# fc = fc[fc.find(".")+1:]
# if fc.find("history") == 0:
# continue
# fc_his = "history" + fc.lower()
# if not arcpy.Exists(fc_his):
# print("Not exists: " + fc_his)
# else:
# print(fc_his)
tb_list = arcpy.ListTables()
for tb in tb_list:
tb = tb[tb.find(".")+1:]
if tb.find("history") == 0:
continue
tb_his = "history" + tb.lower()
if not arcpy.Exists(tb_his):
print("Not exists: " + tb_his)
else:
print(tb_his)