jeepin95

Accessing SDE from script published as GPservice in 10.1

Discussion created by jeepin95 on Jan 16, 2013
Latest reply on Jan 16, 2013 by khibma-esristaff
I am trying to use arcpy and reportlab to generate a report with maps and data tables on a server. Basically the script exports 4 maps (all from the same MXD after setting extent and changing visible layers for each map).

It then creates a feature layer from SDE featureclasses using arcpy.MakeFeatureLayer_management and a selection with arcpy.SelectLayerByLocation_management. It steps through each feature and appends attributes to a list for reportlab to generate the data tables. In the end arcpy.mapping combines all of the interim PDF files into a final multi-page PDF.

This all works from my workstations and generates the reports exactly how I want, however when I try publishing to 10.1 server things stop working. I've fixed most of the problems but am stuck with the SDE featureclasses (SQL 2005) that are directly referenced in the python. Initially I set a string to the path of the feature class "Database Connections\\MyDatabase.sde\\FeatureDataset\\Featureclass" which works perfect from my machine. When it analyzed the tool before publishing the datasource was not registered with the server so I registered it, then published. The GPService fails to run and the error log indicates that it can't find "Database Connections\\MyDatabase.sde\\FeatureDataset\\Featureclass". I then tried moving the .sde file to a static location (C:\temp) on my local machine and the server but now it attempts to copy the entire SDE FC to the server during publish, and won't let me register it again because it is already registered. I removed and re-registered the server and no change. The FC (there are actually 6 different ones) are ~40GB so building the .sd fails.

I thought that when it went through publishing it should have replaced any reference to the registered data source with the servers registered source, but that doesn't seem to be happening or the original configuration should have worked. Any ideas as to how to fix this?

Thanks

Outcomes