ArcPy - TableToTable Creating Duplicate Fields

410
2
Jump to solution
07-25-2017 08:39 AM
jameshickey
Occasional Contributor

Hello all,

I am seeing an issue where ArcPy TableToTable is creating duplicate fields in the output dbf.

Here are the headers in the CSV I am adding: MNAM, MCON, MAD1, MAD2, MCST, MZIP, GISKKK

and yes there is data in columns.

Here is the code I am running

arcpy.TableToTable_conversion(putCSVHere, path, toDBF)

"putCSVHere" is path to CSV which I want to convert that contains the above headers.

"path" is the path to the folder where I am putting the new dbf.

"toDBF" is the name of the dbf file to be created.

My output dbf ends up with the following fields (headers):OID, MNAM, MCON, MAD1, MAD2, MCST, MZIP, GISKKK, Extra Fields:             GISKKK_X,         GISKKK_Y

Data in these fields: 43.6666666667, -1

My question is, where do these extra fields "_X" and "_Y" come from and where does that data come from? It's not in the CSV anywhere

Thank you,

James

0 Kudos
1 Solution

Accepted Solutions
jameshickey
Occasional Contributor

For some reason, somebody in development thought it would be a good idea to have the TableToTable tool assume the data type in a field might be coordinate information. This is ridiculous. The script runs and creates and x and y field because... who knows why.

This is a huge pain to anyone who needs a table structure to not change because they may be using a new table to overwrite an old one.

The schema.ini file has to be edited to make the tool recognize the fields as text and not assume that they are coordinate information just because it is a long number. 

View solution in original post

0 Kudos
2 Replies
jameshickey
Occasional Contributor

For some reason, somebody in development thought it would be a good idea to have the TableToTable tool assume the data type in a field might be coordinate information. This is ridiculous. The script runs and creates and x and y field because... who knows why.

This is a huge pain to anyone who needs a table structure to not change because they may be using a new table to overwrite an old one.

The schema.ini file has to be edited to make the tool recognize the fields as text and not assume that they are coordinate information just because it is a long number. 

0 Kudos
RebeccaStrauch__GISP
MVP Esteemed Contributor

I know you marked this as answered, but will add a few things that might be helpful in the future..

Did you try using the field mapping option?  Table To Table—Help | ArcGIS Desktop 

Using the field mapping control—Help | ArcGIS Desktop 

Also, make sure the "long number" is in quotes...then it should see it as text.

0 Kudos