Table to Table Not Creating Output Table But Also Not Failing or Reporting Any Errors

1222
12
01-15-2019 08:50 AM
BrandonZaitz
New Contributor III

I am attempting to create a .dbf or geodatabase table from a csv. At first i attempted to just use the 'Table to Table' tool. I set up the field mappings and everything just right but when i run the tool it completes in mere seconds and says it has done so successfully. However, when i attempt to find the output table there is nothing there. I tried to use the 'Excel to Table' tool, same result. I even went so far as to create the table using arcpy and looping through the csv row by row and inserting those rows into the table with an insertcursor. I even had it print each row right before inserting.

the last portion of the code:

readcsv = csv.reader(opencsv)
for row in readcsv:
    if "API" not in row[0]:
        print row
        icursor.insertRow(row)

a sample of the output:

['5067088870000', '0.000', '30.670', 'IGNACIO-BLANCO', 'PICTURED CLIFFS']
['5067065920000', '0.251', '370.725', 'IGNACIO-BLANCO', 'PICTURED CLIFFS']
['5067062590000', '0.390', '1021.573', 'IGNACIO-BLANCO', 'PICTURED CLIFFS']
['5067062570000', '0.446', '1100.212', 'IGNACIO-BLANCO', 'PICTURED CLIFFS']
['5067050960000', '0.131', '952.399', 'IGNACIO-BLANCO', 'MESAVERDE']
['5067088870000', '0.000', '1524.118', 'IGNACIO-BLANCO', 'MESAVERDE']
['5067052140000', '7.215', '5309.192', 'IGNACIO-BLANCO', 'PICTURED CLIFFS']
['5067051470000', '0.000', '1051.158', 'IGNACIO-BLANCO', 'MESAVERDE']
['5067052460000', '0.121', '2409.044', 'IGNACIO-BLANCO', 'MESAVERDE']
['5067055830000', '0.000', '3503.423', 'IGNACIO-BLANCO', 'MESAVERDE']
['5067052190000', '0.000', '972.064', 'IGNACIO-BLANCO', 'MESAVERDE']
['5067063900000', '0.476', '1023.767', 'IGNACIO-BLANCO', 'PICTURED CLIFFS']
['5067062600000', '0.121', '4221.302', 'IGNACIO-BLANCO', 'MESAVERDE']

Still nothing, the table exists but it is empty. I'm not sure what else i can do to try and get this data into a .dbf or preferably a geodatabase table.

Any help would be greatly appreciated.

0 Kudos
12 Replies
JoshuaBixby
MVP Esteemed Contributor

Data issues are tough to diagnose in forums without sample data.  Can you strip down the data set and post it here? 

0 Kudos
BrandonZaitz
New Contributor III

It is all proprietary, just that bit I showed that was printing is probably too much. I am just confused as to why no errors are being reported but nothing is happening on the output side for two tools and my script.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Can you create some fictitious/sample data that replicates the issue?  I have used in the past all of the tools you describe to do similar workflows and they worked fine, so it is either something with the data or workflow. 

0 Kudos
BrandonZaitz
New Contributor III

here is some sample data that i cannot get to create a table either... just drop into notepad or something and save as csv.

API,Oil_EUR_MBBL,Gas_EUR_MMcf
5652846240000,0.000,30.670
5897751350000,0.251,370.725
5984332480000,0.390,1021.573

0 Kudos
BrandonZaitz
New Contributor III

I just wrote out what I had written in the console into a python scripts and ran it separately and it worked. Still, 'table to table' does not work for that sample of data i just pasted in my earlier reply

.

0 Kudos
DarrenWiens2
MVP Honored Contributor

Can you post your entire script? We can't see important parts like how you create your insert cursor or run table to table (don't just include those parts, post the whole thing).

0 Kudos
BrandonZaitz
New Contributor III

My script is working fine now. I wrote something to clean up the csv (remove commas from numbers, etc) and then included more arguments when adding fields to my created table (precision, etc) and that did the trick. However, the GUI toolbox 'table to table' tool on the same cleaned up csv exporting to the same geodatabase is not creating any output. So, at this point it doesn't really matter to me all that much but people I work with I'm sure would like to be able to use that tool. So if anyone has any insight on that I would be interested to hear it.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I took your four lines, header and three rows of data, and put them in a CSV file on the file system.  I then ran the following code:

import arcpy

csv =  # path to csv file
out_path = arcpy.env.scratchGDB
out_name = 'sample'

arcpy.TableToTable_conversion(
    csv,
    out_path,
    out_name
)‍‍‍‍‍‍‍‍‍‍‍

It worked fine for me, although it did convert API to a Double, but that could be handled in a field mapping.

What version of ArcGIS Desktop or Pro are you using?

BrandonZaitz
New Contributor III

Yeah, it runs when I call the function in python essentially in a near identical fashion as you did above. However, using the GUI with the same inputs still yields no new table. Very odd. Im running version 10.6.1.9270.

0 Kudos