Select to view content in your preferred language

ERROR 000732 on executing TableToTable

2611
11
06-04-2018 05:58 AM
AndreasRuloffs1
Occasional Contributor

Hi there,

I am facing a strange Problem. In the following Script two Tables in an sql-Server Database should be exported.

The first one works, the second one not (I am sure it is spelled right).

import tempfile
import arcpyout

Location = tempfile.mkdtemp()
arcpy.TableToTable_conversion("../bamo.sde/bko.bkEingriffart",outLocation, "bkEingriffart.dbf")
arcpy.TableToTable_conversion("../bamo.sde/bko.bkMassnahmenbkMassnahmenZiele",outLocation, "bkMassnahmenbkMassnahmenZiele.dbf")‍‍‍‍‍‍‍‍‍‍

‍‍‍‍‍‍‍
I got the Error:

Traceback (most recent call last):  
File "C:\Users\xxx\.p2\pool\plugins\org.python.pydev_5.7.0.201704111357\pysrc\pydevd.py", line 1546, in <module>    
globals = debugger.run(setup['file'], None, None, is_module)  
File "C:\Users\xxx\.p2\pool\plugins\org.python.pydev_5.7.0.201704111357\pysrc\pydevd.py", line 982, 
in run    pydev_imports.execfile(file, globals, locals)  # execute the script  
File "C:\Repositories\Python\bkonline2-deploy\gp-services\bko\exportSHP.py", line 13, in <module>    
arcpy.TableToTable_conversion("../bamo.sde/bko.bkMassnahmenbkMassnahmenZiele",outLocation, "bkMassnahmenbkMassnahmenZiele.dbf")  
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\conversion.py", line 2133, in TableToTable    
raise earcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Rows: Dataset ../bamo.sde/bko.bkMassnahmenbkMassnahmenZiele does not exist or is not supportedFailed to execute (TableToTable).‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


I use ArcGIS 10.3.1 for develpoing, but the error also occurs when using ArcGIS 10.5.1.

Later the Script shell run as a geoprocessing Task on an ArcGIS for server.

Has anybody an idea?

Best Regard,

Andreas

0 Kudos
11 Replies
JoeBorgione
MVP Emeritus

To me it looks like you are missing a comma and some parentheses

# yours :  import tempfileimport arcpy
import tempfileimport, arcpy   #note comma...

# yours:  arcpy.TableToTable_conversion("../bamo.sde/bko.bkMassnahmenbkMassnahmenZiele",outLocation, "bkMassnahmenbkMassnahmenZiele.dbf")

arcpy.TableToTable_conversion(("../bamo.sde/bko.bkMassnahmenbkMassnahmenZiele",outLocation, "bkMassnahmenbkMassnahmenZiele.dbf"))  # note enclosing parentheses...


‍‍‍‍

 Just a WAG  (wild a$$ guess...)

That should just about do it....
AndreasRuloffs1
Occasional Contributor

Thank you Joe,

some new Lines got missing, I correct that.

I do not understand the part with the parantheses TableToTable_conversion works with a single Table.

0 Kudos
JoeBorgione
MVP Emeritus

My apologies Andreas- when I first read your post I thought I saw that you were using the output of a second TableToTable function as input to a first TableToTable function.  Your use of relative paths may be problematic as well.

I'm not familiar with the use of tempfile, so my approach would be to set the out put workspace as an arcpy env variable:

import arcpy
from arcpy import env

arcpy.env.workspace = r'DriveLetter:\your\desired\path\to\output\directory'
out_ws = arcpy.env.workspace


# use a complete path to your sde connection and file name
# below is an example of one of mine

in_table = r'T:\GIS Documents\AddressPOC2017\AddIn\SLCOGIS_Joe.sde\SLCOGIS.GDB_ADD.DB2_StreetFile'

out_table = 'YourNameOfChoice.dbf'

arcpy.TableToTable_conversion(in_table,out_ws,out_table)


‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
That should just about do it....
AndreasRuloffs1
Occasional Contributor

Unfortunately this makes no difference.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

What if you comment out the first table conversion, does the second one (now the first) err out?  It is good to isolate whether it is the call itself or calling something successively that is causing an issue.

0 Kudos
AndreasRuloffs1
Occasional Contributor

If I comment out the first T2T conversion, then the second one fails anyway.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

How is bkMassnahmenbkMassnahmenZiele different than bkEingriffart in terms of structure, e.g., is one a feature class and the other one a table?

If both are just tables, my money is on permissions.  If the T2T tools can't open the table to read it, it will report it does not exist or is not supported.

0 Kudos
AndreasRuloffs1
Occasional Contributor

bkEingriffart is just a simple table, bkMassnahmenbkMassnahmenZiele  is a table to resolve an m to n relationship. Therefor it has a composite primary key.

0 Kudos
AronSaylor
New Contributor

I am having issues similar to this. Was your issues ever resolved?

0 Kudos