laptop and a wrench

漏洞

The arcpy.FieldMap or arcpy.FieldMappings object, or both fail to handle a date field in ArcGIS Pro 3.x. Dates are not populated in the appropriate field.

ArcGIS Pro
漏洞 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 Pro

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项