I had this working on my local computer but when switching it over to the server it is failing with the following error:
Failed to execute. Parameters are not valid.
ERROR 000793: Invalid data element type
ERROR 000840: The value is not a Raster Layer.
Failed to execute (MakeQueryTable).
I think is has something to do with the OLE DB connection...when I open the connection in arcCatalog it takes a longgggg time to open. Maybe it is timing out in the script and thus that is why it is failing? I have included my code below too.
tableList = ["DATABASE CONNECTIONS/prod.odc/sales"]
fieldList = ["sales.id",'id']
whereClause = "sales.CREATED_DATE between to_date(sysdate, 'DD-MON-YYYY') AND SYSDATE"
keyField = "sales.id"
lyrName = "live_sales"
#Create the spatial reference for the output layer.
sr = arcpy.SpatialReference("WGS 1984 UTM Zone 12N")
# Create a query layer
arcpy.MakeQueryTable_management(tableList, lyrName,"USE_KEY_FIELDS", keyField, fieldList, whereClause)
# save the created query layer
arcpy.SaveToLayerFile_management(lyrName,"I:/sales.lyr", "ABSOLUTE")
# Print the total rows
print arcpy.GetCount_management(lyrName)
Thanks in advance!