I have a set of feature classes in file gdb. while exporting these to SDE via arcpy, the field names "SHAPE_Length" and "SHAPE_Area" got changed to"SHAPE.LEN" and "SHAPE.AREA" respectively.
There was alias name for both these fields in GDB which got missed in the SDE.
I could right click on the feature class and from the properties window i can update the alias name of these fields. But the "Alter Field" tool in "Data Management Tools" fails to update the alias name for these fields.
I've a lot of feature classes and its not practical to manually update the fields.
Is there any way to preserve the field alias for these fields during the export? Or is there any other way to update the alias name programmatically.
I've used the CopyFeatures_management in arcpy to export the feature classes.
Thanks in advance.
Is there any particular reason you need a specific alias for these required fields?
You could run through the tables again using the AlterField tool in the Data Management / Fields toolset.
what additional permission is required for this ?
I'm able to modify other fields using the AlterField tool. Also, I'm able to manually update the alias name of these fields ("SHAPE.LEN" and "SHAPE.AREA" ) by right clicking on the feature class.
My ArcGIS Desktop Version is 10.3 and I'm connecting to Oracle using direct connection.
Sorry, don't have access to an SDE here to test anything (and definately not on Oracle).
There are a few hits from here on Geonet and SE regarding renaming Alias names but am am not sure if they apply in your case.
I'm not even able to alter the alias for a field in GDB feature class
Here is the sample code used to alter the alias name:
fc = r"C:\Users\jose\Documents\ArcGIS\Default.gdb\World_Map"
desc = arcpy.Describe(fc)
arcpy.AlterField_management(fc, desc.AreaFieldName, new_field_alias="Shape Area")
arcpy.AlterField_management(fc, desc.LengthFieldName, new_field_alias="Shape Length")
I'm getting the following error:
arcgisscripting.ExecuteError: ERROR 001625: Failed to alter field is nullable.
Failed to execute (AlterField).
Even the script and the AlterField tool are throwing exceptions, I could see that the SDE feature classes got updated with the new alias provided. So I'm planning to ignore these errors and continue with the script.
Thanks for the support.