I have a script I'm working on that takes a SQL table view and performs a Table to Table (arcpy.TableToTable_conversion
)
If I leave out the Where Clause the Table to Table works flawlessly, however if I include the Where Clause it fails throwing Error 000339 "Input does not have OIDs". Typically the way to overcome this error is to copy the table (or table to table) but this is what I'm doing. The table is quite large and takes some time to copy, which is why I'm trying to add the Where Clause.
Is there another way I can get my table copied, filtered by Where Clause, that won't throw the missing OID error?
whereclause = "FeatID IN ('501684', '179845', '173458', '509634')"
arcpy.TableToTable_conversion(WMTR_Pivot, TargetDB, "xxTest_WMTR_Pivot", whereclause, wmtr_fms, "")
Note: FeatID
is a text field.
Error:
Traceback (most recent call last): File "xxAppendMeters.py", line 231, in <module>
arcpy.TableToTable_conversion(WMTR_Pivot, TargetDB, "xxTest_WMTR_Pivot", whereclause, wmtr_fms, "") File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\conversion.py", line 2133, in TableToTable
raise e ExecuteError: ERROR 000339: Input v_WMTR_Pivot does not have OIDs Failed to execute (TableToTable).
My table view has about 75000 records, and I'm trying to filter that to about 150 records with the Where Clause. I've trimmed that to 4 in the code snippet above.
Table is in SQL Server 2012 Enterprise Geodatabase, on my PC I'm running ArcGIS Desktop 10.3.1