I have a line shapefile with 100+ fields and a separate dbf file with 100+ fields. I'd like to programatically (using arcpy and Python 3) eliminate all but 3 fields in both shapefile and the dbf, and then join on a common field. The desired output would only contain 5 fields.
If I do a simple join:
joined = arcpy.AddJoin(path_to_shp, "id_field", path_to_dbf, "id_field")
I cannot delete the extra fields. And if I write this joined table to a file, the joined field names become unrecognizable due to length constraints.
I was looking at the 'field_info' parameter of MakeFeatureLayer, but I can't find any examples of how this would be implemented, and it seems like none of the tools I'd normally use for this take FieldMappings.