AnsweredAssumed Answered

Does CreateFeatureclass_management preserve field order?

Question asked by CCStormwater on Jun 17, 2013
Latest reply on Jun 18, 2013 by mzcoyle
EDIT: My question about order preservation still stands, but my root needs are better addressed on my follow up question here: (Is there a token for everything EXCEPT SHAPE@):  Creating my own "complete" field list proved easier than I was imagining, and was solved by a function provided by Caleb1987 on the above link.

Original question:

The CreateFeatureclass_management help page describes the Template parameter as: 
The feature class used as a template to define the attribute schema of the feature class.
Does this include the field order?  I ask because the help page for arcpy.da.insertcursor says:
Use an asterisk (*) instead of a list of fields if you want to access all fields from the input table [...]. However, for faster performance and reliable field order,

In other words, if I use a search cursor with "*" for fields then can I directly assign that tuple to my new FC?  i.e. is the following valid?  Will the field order for the row tuple be preserved between the template and new feature classes (excepting the caveats in the help pages regarding blob and raster types)?

arcpy.CreateFeatureclass_management( newFCpath, newFCname, "POINT", templateFC, "DISABLED", "DISABLED", templateFC )  newRows      = arcpy.da.InsertCursor(newFC,      "*") templateRows = arcpy.da.SearchCursor(templateFC, "*")  for row in templateRows:     newRows.insertRow( row )

PS: I just thought of an additional caveat when using feature classes with different geometries, but I've formed it as a separate question here (Is there a token for everything EXCEPT SHAPE@):

PPS: Based on comments from Caleb1987 on my other post I realize the code above will not work because the OID will be a part of the tuple from the search cursor, and I can't assign the OID to the new feature.  The question about field order still stands though.