1

I append features from one class to other (using arcpy.Append_management including FieldMappings). The issue is I overshoot the length of target field. I do wonder why Append_management does not deal with such issue, anyway...

For now I can increase the length of target field which fixed the issue. But I still need somehow check the length of input string. And do sub-string if needed so the tool won't crash whenever there too long string in input data. Any simple way to achieve this?

1 Answer 1

2

I decided to not use arcpy.Append_management as it crashes on input longer than length of target field. As far as I know there is no way to check. For this reason I would suggest NOT to use Append together with field_mapping unless you are completely sure the inputs can't hit the length limitation of output.

Not sure if Append checks input/output field length when not using field mapping. If it checks only field names and types there is again space for crash.

At the end I decided to use combination of arcpy.da.SearchCursor and arcpy.da.InsertCursor and before Insert use slicing with the target field length to make sure there is no overshoot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.