I'm not quite sure where this should go, so cross posting.
We have an on premise portal with a feature service published. We're trying to write a python script that will run a geoprocessing tool against this service. Right now it's extremely simple; authenticate to portal, look at the service, and run arcpy.Statistics_analysis against it. All we want to do is get an output table of statistics. Now, if I do this in python directly against the database, no problems. But when running it against the service... it SEES the service, but it fails on the analysis. Can anyone help??
def run(self):
self._sign_into_portal()
#self._build_scratch_fgdb()
lines = arcpy.SearchCursor(
"https://servername/arcgis/rest/services/DENC/Yanceyville_UN/FeatureServer/3"
)
for line in lines:
print(line.getValue("OBJECTID"))
stats_table = "C:/temp/services_test.gdb/stats_out"
stat = [["st_length", "SUM"]]
arcpy.Statistics_analysis(lines, stats_table, stat)