Good afternoon,
I have a standard append script, how could I just load the a fieldmap file that I saved?
Append = arcpy.management.Append(inputs=[feature_class], target=hosted_feature, schema_type="NO_TEST", field_mapping="***Load FieldMap File***")
Append takes FieldMappings objects that can be created using a .loadFromString:
import arcpy import os def load_fieldmap(path: os.PathLike) -> arcpy.FieldMappings: with open(path, 'r') as fieldmap: return arcpy.FieldMappings().loadFromString(fieldmap.read()) arcpy.management.Append( inputs=["C:/path/to/input.gdb/input"], target="C:/path/to/output.gdb/output", schema_type="NO_TEST", field_mapping=load_fieldmap("C:/path/to/fieldmap.fieldmap") )
Hi @CW-GIS can you post an example of your fieldmap file?
Also, have you seen the example of using Field Mappings in the following example?
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.