漏洞
漏洞 ID 编号 | BUG-000161939 |
---|---|
已提交 | October 6, 2023 |
上次修改时间 | June 5, 2024 |
适用范围 | ArcGIS Pro |
找到的版本 | 3.1 |
操作系统 | Windows OS |
操作系统版本 | 10.0 |
状态 | Duplicate |
The best practice for using the arcpy.FieldMapping() and arcpy.FieldMappings() objects is to construct the field mapping by adding the target and input dataset fields using addTable first. The following code snippet produced the expected output for the provided script:
... try: ## Truncate the staging table ap.TruncateTable_management(tblCntyDataStaging) ## Run the arcpy fieldmapper to map field name changes between the two schemas fms = arcpy.FieldMappings() ### Use addTable for target and input per best practices fms.addTable(tblCntyDataStaging) fms.addTable(tblCntyDataSource) ### for field in fieldList_cds: if field.name != "OBJECTID": fm = arcpy.FieldMap() fm.addInputField(tblCntyDataSource, field.name) f_out = fm.outputField f_out.name = fieldMapDict_cd[field.name] f_out.type = field.type fm.outputField = f_out fms.addFieldMap(fm) # Populate the fresh table into the staging table arcpy.Append_management( tblCntyDataSource, tblCntyDataStaging, "NO_TEST", field_mapping=fms ) ...
漏洞 ID: BUG-000161939
软件:
获取来自 ArcGIS 专家的帮助
下载 Esri 支持应用程序