Hello everyone,
I am getting the following error message when running in Python an append -arcpy.Append_management- between a table in SDE and a table from a SQL database.
This append works fine in Model Builder.
# Process: Truncate Table
arcpy.TruncateTable_management(sde_Table)
# Process: Append
arcpy.Append_management("'Database Connections\\Consumption Production.sde\\Consumption.SQLDatabaseTable'", sde_Table__2_, "NO_TEST", "PREMID \"PREM_ID\" true true false 10 Text 0 0 ,First,#,Database Connections\\Consumption Production.sde\\Consumption.SQLDatabaseTable,PREMID,-1,-1;TOTALGALSEW \"TOTAL_GALLONS_WATER\" true true false 8 Double 2 18 ,First,#,Database Connections\\Consumption Production.sde\\Consumption.SQLDatabaseTable,TotalGallonsWater,-1,-1;GPD \"GALLON_PER_DAY\" true true false 8 Double 2 18 ,First,#,Database Connections\\Consumption Production.sde\\Consumption.SQLDatabaseTable,GPD,-1,-1", "")
Greetings Jose,
Error 000187: Only supports Geodatabase tables and feature classes Failed to execute is somewhat a vague error and can be thrown for a few reasons:
First thing I would try is changing the EZ path to full file path, that's where I would start in all of this.
In your case Database Connections\\Consumption Production.sde\\Consumption.SQLDatabaseTable to C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.x\ArcCatalog\<databasename>.sde
You can set the database full path as the environment settings using arcpy.env.workspace = <database file pth> then reference the table or use the file path C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.x\ArcCatalog\<databasename>.sde\<table>
Let me know if this helps.
I had a similar issue using the arcpy.Truncate_management tool in ArcGIS 10.6.1. When I wrote out the full path to my feature classes on my SDE database, the tool worked in Python:
r"C:\Users\mmolter\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog\DatabaseName\Feature Class name"
Before, I referenced the feature class like this but Python didn't like it. Even though it worked in ModelBuilder:
"Database Connections\\DatabaseName\Feature Class name"
Thanks for the suggestion!