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
Hi Aron,
unfortunately, it was not really solved, the Problem seemed to be that the table had not a simple key but a Composite one.
I solved it by adding a view to the database that joined both of the tables. Then I was able to use TableToTable on the view.
I hope this is an Option for you too.
Best regards,
Andreas
I am having similar issues while converting a pandas dataframe to gdb table as well.
See coed below. It did run the first time I ran but has bee failing since. I have tried running it by changing workspace as well.
"
gdb_path = r"Z:\Shared\SMS GIS\Long_Term_Projects\Development_Environmental_Tracker_GIS\Project_Packet_DataUpload_FINAL.gdb"
table_name = "Dev_Portfolio"
arcpy.env.workspace = r"Z:\Shared\SMS GIS\Long_Term_Projects\Development_Environmental_Tracker_GIS\Project_Packet_DataUpload_FINAL.gdb"
out_ws = arcpy.env.workspace
# # Convert the DataFrame to a gdb table
# arcpy.TableToTable_conversion(df, gdb_path, table_name)
try:
# Convert the DataFrame to a gdb table
arcpy.TableToTable_conversion(df, out_ws, table_name)
print(f"DataFrame converted to gdb table: {table_name}")
except arcpy.ExecuteError as ee:
print("ArcPy ExecuteError occurred:")
print(ee)
except Exception as e:
print("An error occurred:")
print(e)
"