Can run a geoproces from ArcMap using an SDE connection. However when I publish the geoproces service I can't access the server directly. So I need a way to pass the SDE connection in the script. Tried to pass both a connection and a constant string but then I get the following error on the SearchCursor:
Error executing tool. Get Netwerkcell ID from Point Job ID: j085f9066b9994287b75a02abee7b878b : Traceback (most recent call last): File "PATH TO SERVICE\NetwerkIDFromPoint.GPServer\extracted\v101\arcgishomefolder\select_point.py", line 16, in env.workspace = arcpy.arcpy.env.packageWorkspace(2) TypeError: 'unicode' object is not callable Failed to execute (NetwerkIDFromPoint). Failed to execute (Get Netwerkcell ID from Point).
Intention of the script is a simple query of a point to get an ID, this works correct in ArcMap.
However on the server this does not run, I assume that it does something with the provided parameters, tried to change the type from connection to SDE but this did not solve the problem.
What is the concise way to pass an SDE connection to the server and what are the best practices for passing connections in a DTAP environement?
The database is also registered under datastores, how can I link the registered datastore to my package environement so I can skip the offending line?
env.workspace = arcpy.GetParameterAsText(2)
env.workspace = arcpy.arcpy.env.packageWorkspace(2)
Changed this to
env.workspace = os.path.join(sys.path, 'arcgishomefolder', 'SQL.sde')
This seems to work, however this gives a high exception:
|High||Unresolved||24032||Data source used by Script SelectPoint is not registered with the server and will be copied to the server: H:\dev\gis4all\lekzoekenPlus\arcgishomefolder Tool||SelectPoint||Tool|
However when I register the datasource it says that it already has this connection:
Performance is orders of magnitude slower, don't know if this is the most concise way to get a connection to an SDE. Any thoughts?