shsmi_sysdb_nex/sde_fc2fc.py

31 lines
938 B
Python

# coding=utf-8
import sys
from imp import reload
import arcpy
reload(sys)
sys.setdefaultencoding('utf8')
# 获取参数
args = sys.argv[1:]
if not args or len(args) < 6:
sys.exit("参数不足:需要文件路径")
else:
src_sde = args[0]
type_name = args[1]
fc_name = args[2]
outLocation = args[3]
fc_cur = args[4]
expression = args[5]
arcpy.env.workspace = src_sde
if type_name == u'feature':
print(' [sde_fc2fc.py]: ' + '##output feature##')
fc_out = arcpy.FeatureClassToFeatureClass_conversion(fc_name, outLocation, fc_cur, expression)
print(' [sde_fc2fc.py]: ' + str(arcpy.GetCount_management(fc_out)))
elif type_name == u'table':
print(' [sde_fc2fc.py]: ' + '##output table##')
fc_out = arcpy.TableToTable_conversion(fc_name, outLocation, fc_cur, expression)
print(' [sde_fc2fc.py]: ' + str(arcpy.GetCount_management(fc_out)))