I have a script that needs to be published to ArcGIS Server as a geoprocessing service. This script computes a set of records in table form. I need to set an output parameter so that it returns the table (recordset).
So, to make sure I have a table (not a feature class), I am using arcpy.TableToTable_conversion(), outputting the table to the in_memory workspace. So, I know I have a table. I know that it has records, as I can perform an arcpy.GetCount and get the number of records.
I have the output parameter defined. Here's what it looks like:
arcpy.SetParameter(2, theTable)
No matter what I try this does not work. In my toolbox, the output parameter is set as a RecordSet. I've tried supplying a recordset object, the path to the in-memory feature class, and many other ideas.
How do you properly handle outputting a table to a recordset output using SetParameter for ArcGIS server?