Only export defined tool paramenters from ModelBuilder to python file

05-31-2021 08:17 PM
Status: Open
Labels (1)
Regular Contributor

When exporting a Model Builder model to a python file, I've found that it includes all tool parameters in the export even if I haven't defined them in the tool. For example (and where I had problems arise), I have used the Alter Field tool in a model to alter the Field Name and sometimes Field Alias. All other options were ignored (they're optional or didn't apply - mainly the Clear Alias option). 



Data_Requests_7_ =, field="OwnerSname", new_field_name="OwnerS", new_field_alias="", field_type="", field_length=8000, field_is_nullable="NON_NULLABLE", clear_field_alias="DO_NOT_CLEAR")[0]




Data_Requests_10_ =, field="Actual_Start", new_field_name="OpStart", new_field_alias="OpStart", field_type="", field_length=8, field_is_nullable="NON_NULLABLE", clear_field_alias="DO_NOT_CLEAR")[0]


 When I first ran the python script, I found an error occurred because it failed to set the field_is_nullable parameter. Once I deleted the parameters after the new_field_alias option out and ran the model again, it worked fine. 

Proposal: When exporting a model to python, only include tool parameters that have been purposefully defined, and not just assumed with a default value (above code would appear like the below example). 

Data_Requests_7_ =, field="OwnerSname", new_field_name="OwnerS")[0]


Data_Requests_10_ =, field="Actual_Start", new_field_name="OpStart", new_field_alias="OpStart")[0]