I have a fairly large script that I’m reworking. The script is manipulating tables with 50 or so fields. (I will be cleaning some of these up to reduce the number.) Toward the end of my script I call the Append_management tool and and trying to simplify the field mapping component of that process by utilizing the FieldMappings object.
Question:
Is it possible to use the FieldMappings object only for the fields where the input and target field names differ? In other words; I would like to tell the script that if it finds matching fields, to use those, and for all other that where the field names differ, refer to the FieldMappings object.
Does this make sense?
Below is a sample of my Append_management section of code.
arcpy.Append_management(PZSPJoin, out_fc, "NO_TEST", "Join_Count "Join_Count" true true false 4 Long 0 10 ,First,#,Jun12May13PZoneSPJoin,Join_Count,-1,-1;
TARGET_FID "TARGET_FID" true true false 4 Long 0 10 ,First,#,Jun12May13PZoneSPJoin,TARGET_FID,-1,-1;
Status "Status" true true false 1 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,Status,-1,-1;
Score "Score" true true false 2 Short 0 5 ,First,#,Jun12May13PZoneSPJoin,Score,-1,-1;
Match_type "Match_type" true true false 2 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,Match_type,-1,-1;
Stan_addr "Stan_addr" true true false 79 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,Stan_addr,-1,-1;
Match_addr "Match_addr" true true false 103 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,Match_addr,-1,-1;
ARC_Street "Street" true true false 60 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,ARC_Street,-1,-1;
ARC_Zone "Zone" true true false 40 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,ARC_Zone,-1,-1;
ADDRESS "ADDRESS" true true false 37 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,ADDRESS,-1,-1;
CITY "CITY" true true false 20 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,CITY,-1,-1;
ZIP "ZIP" true true false 5 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,ZIP,-1,-1;
STSUB "STSUB" true true false 16 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,STSUB,-1,-1;
POSTDIR "POSTDIR" true true false 3 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,POSTDIR,-1,-1;
UNITID "UNITID" true true false 16 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,UNITID,-1,-1;
XCOORD "XCOORD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,XCOORD,-1,-1;
YCOORD "YCOORD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,YCOORD,-1,-1;
JUN_12CCF "JUN_12CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,JUN_12,-1,-1;
JUL_12CCF "JUL_12CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,JUL_12,-1,-1;
AUG_12CCF "AUG_12CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,AUG_12,-1,-1;
SEP_12CCF "SEP_12CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,SEP_12,-1,-1;
OCT_12CCF "OCT_12CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,OCT_12,-1,-1;
NOV_12CCF "NOV_12CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,NOV_12,-1,-1;
DEC_12CCF "DEC_12CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,DEC_12,-1,-1;
JAN_13CCF "JAN_13CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,JAN_13,-1,-1;
FEB_13CCF "FEB_13CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,FEB_13,-1,-1;
MAR_13CCF "MAR_13CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,MAR_13,-1,-1;
APR_13CCF "APR_13CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,APR_13,-1,-1;
MAY_13CCF "MAY_13CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,MAY_13,-1,-1;
JUN_12MGD "JUN_12MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,JUN_12MGD,-1,-1;
JUL_12MGD "JUL_12MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,JUL_12MGD,-1,-1;
AUG_12MGD "AUG_12MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,AUG_12MGD,-1,-1;
SEP_12MGD "SEP_12MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,SEP_12MGD,-1,-1;
OCT_12MGD "OCT_12MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,OCT_12MGD,-1,-1;
NOV_12MGD "NOV_12MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,NOV_12MGD,-1,-1;
DEC_12MGD "DEC_12MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,DEC_12MGD,-1,-1;
JAN_13MGD "JAN_13MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,JAN_13MGD,-1,-1;
FEB_13MGD "FEB_13MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,FEB_13MGD,-1,-1;
MAR_13MGD "MAR_13MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,MAR_13MGD,-1,-1;
APR_13MGD "APR_13MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,APR_13MGD,-1,-1;
MAY_13MGD "MAY_13MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,MAY_13MGD,-1,-1;
ACCTCLASS "ACCTCLASS" true true false 30 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,ACCTCLASS,-1,-1;
LOC_DESC "LOC_DESC" true true false 254 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,LOC_DESC,-1,-1;
CUSTOMER "CUSTOMER" true true false 30 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,CUSTOMER,-1,-1;
SUBGROUP "SUBGROUP" true true false 10 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,SUBGROUP,-1,-1;
PRESSZONE "PRESSZONE" true true false 4 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,PRESSZONE,-1,-1;
PZONE_A_ID "PZONE_A_ID" true true false 4 Long 0 10 ,First,#,Jun12May13PZoneSPJoin,PZONE_A_ID,-1,-1;
AREA_ "AREA_" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,AREA_,-1,-1;
PRES_ZONE "PRES_ZONE" true true false 4 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,PRES_ZONE,-1,-1;
PZ_DESC "PZ_DESC" true true false 50 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,PZ_DESC,-1,-1;
HGL_FT "HGL_FT" true true false 4 Long 0 10 ,First,#,Jun12May13PZoneSPJoin,HGL_FT,-1,-1;
WELL_CAP_GPM "WELL_CAP_GPM" true true false 4 Long 0 10 ,First,#,Jun12May13PZoneSPJoin,WELL_CAP_GPM,-1,-1;
B_PUMP_GPM "B_PUMP_GPM" true true false 4 Long 0 10 ,First,#,Jun12May13PZoneSPJoin,B_PUMP_GPM,-1,-1;
GND_STOR_MG "GND_STOR_MG" true true false 4 Long 0 10 ,First,#,Jun12May13PZoneSPJoin,GND_STOR_MG,-1,-1;
ELEV_STOR_MG "ELEV_STOR_MG" true true false 4 Long 0 10 ,First,#,Jun12May13PZoneSPJoin,ELEV_STOR_MG,-1,-1;
CREATEUSER "CREATEUSER" true true false 30 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,CREATEUSER,-1,-1;
CREATEDATE "CREATEDATE" true true false 36 Date 0 0 ,First,#,Jun12May13PZoneSPJoin,CREATEDATE,-1,-1;
MODUSER "MODUSER" true true false 30 Text 0 0 ,First,#,Jun12May13PZoneSPJoin,MODUSER,-1,-1;
MODDATE "MODDATE" true true false 36 Date 0 0 ,First,#,Jun12May13PZoneSPJoin,MODDATE,-1,-1;
TotalCCF "TotalCCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,TotalCCF,-1,-1;
TotalMGD "TotalMGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,TotalMGD,-1,-1;
AnnualAVG_CCF "AnnualAVG_CCF" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,AnnualAVG_CCF,-1,-1;
AnnualAVG_MGD "AnnualAVG_MGD" true true false 8 Double 8 38 ,First,#,Jun12May13PZoneSPJoin,AnnualAVG_MGD,-1,-1;
Download "Download" true true false 36 Date 0 0 ,First,#,Jun12May13PZoneSPJoin,Download,-1,-1", "")