AnsweredAssumed Answered

trying to run geoprocessing tool against service on portal in python...

Question asked by ardaiel on Dec 16, 2019
Latest reply on Jan 2, 2020 by dougbrowning

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://gisgas03dv.devl.scana.com/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"
# stats_table = self.config.get("scratch_fgdb_path")
# print(stats_table)
stat = [["st_length", "SUM"]]

arcpy.Statistics_analysis(lines, stats_table, stat)

Outcomes