Select to view content in your preferred language

renaming a geodatabase table with Field Mapping and python

643
0
01-25-2011 01:34 PM
DwightWilhelm
Emerging Contributor
*EDIT* I apologize for the misleading name. I meant to say renaming a geodatabase table "Field name" with Field Mapping and Python

I've been working on a python script to do some data reformatting and output to a file geodatabase table. I start with a pipe delimited text file and end with a table. For some reason the text file has some hidden characters that show up in the first Field name (e.g., $%^FIELD_ID) so I need to rename it so those characters are no longer an issue (e.g., FIELD_ID). I can do this easily in the Field Mapping dialogue of the TableToTable tool, which is how I am getting my text file into a file geodatabase. I can also do this inside ModelBuilder as long as I'm using a static file name. However, I need to be able to accomplish this task when the file name isn't static (i.e., its user defined in a dialogue box). My guess is that within a python script I should be able to read the field names just like the TableToTable dialogue does and then rename it in the same fashion. Unfortunately, there really isn't any documentation on renaming field names. Does anyone know the appropriate python syntax for field mapping so that my script can remain dynamic?

Thanks,
0 Kudos
0 Replies