Creating geodatabase feature class using geodatabase table schema with ArcPy?

Here's code for the solution based on the accepted answer:

#define the input table name  
tblIN = "LFA_WYKAZ"  
#define new feature class name  
fcOUT = "LFA"  
#define projection  
projection = "c:\Program Files\ArcGIS\Desktop10.0\Coordinate Systems\Projected Coordinate Systems\National Grids\Europe\ETRS 1989 Poland CS92.prj"  
#create empty polygon feature class  
arcpy.CreateFeatureclass_management(arcpy.env.workspace, fcOUT, "POLYGON", "", "", "", projection)  
#join fields from the input table  
arcpy.JoinField_management(fcOUT, "OBJECTID", tblIN, "OBJECTID")

Below you'll find code for the solution based on @John's answer. Upto ArcGIS 10.0 JoinField is available only for ArcInfo. This one will work for all licence levels:

#define input table name
tblIN = "LFA_WYKAZ"
#define new feature class name
fcOUT = "LFA"
#define projection
projection = "c:\Program Files\ArcGIS\Desktop10.0\Coordinate Systems\Projected Coordinate Systems\National Grids\Europe\ETRS 1989 Poland CS92.prj"
#create empty polygon feature class 
arcpy.CreateFeatureclass_management(arcpy.env.workspace, fcOUT, "POLYGON", "", "", "", projection)
#acquire field list from the input table
desc = arcpy.Describe(tblIN)
fieldListComplete = desc.fields
#limit field list to all fields except OBJECT_ID
fieldList = fieldListComplete[1:]
#create fields in the output feature class
for i in fieldList:
    arcpy.AddField_management(fcOUT, i.name, i.type, "", "", i.length)

Well, it looks from the documentation like you can define a feature class as a template input via python as well. So, one option would be to add an X and Y field (make sure they are the right data type (I know double works, not sure what others). Then you can even calculate all of those as 0,0 or just leave null. Then create XY Event Layer from that table, and use the output as the input schema for the new feature class except delete the X and Y fields you created.

Otherwise, if you don't want to do something along that lines, I don't know the specifics of this part of ArcPy well enough to type up sample code for you or anything, but might I suggest you just look at, instead of importing another schema as a template, why don't you use ArcPy to identify the details of each field in the table http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000012000000 and then from that you could loop through each field in the resulting fields object and re-create each field from those details in the new feature class by calling the AddField GP Tool or something along that lines.

I'm not saying either of those are the absolute ideal answer you're looking for, nor am I swearing they're computationally the absolutely most efficient (because like I said, I've not personally done that in ArcPy), but they should work. Hope it helps.


You can try JoinField to join the geodatabase Table to the blank Featureclass. The join field can be Objectid. The resulting fields should be blank.