Publishing PYT with input workspace parameter pointing to versioned GDB

Discussion created by mleahyesri-ca-esridist Employee on Feb 26, 2013
Hello all,

I know that ArcGIS server (10.1.1) disallows the same geodatabase connection to be registered twice, but it does not seem to object to having data stores registered that point to different versions in the same geodatabase.  Is this something that should not be done?

The issue I've encountered happens when I publish a new tool from a python toolbox as a GP service.  One of its input parameters is a workspace, and when I execute the tool, the workspace I point to is an SDE enterprise geodatabase connection file that references a specific version in the enterprise geodatabase on my local machine (sde.Dev).

On the ArcGIS server site, I have a data store registered that uses a different connection for the publisher/server database, where the server has an identical schema, and identical versioning setup.  The connection data through the admin REST API looks like the following:

  "path": "/enterpriseDatabases/gdbname_dev",
  "type": "egdb",
  "id": null,
  "clientPath": null,
  "totalRefCount": 0,
  "info": {
    "dataStoreConnectionType": "replicated",
    "isManaged": false,
    "clientConnectionString": "ENCRYPTED_PASSWORD=xxxxx;SERVER=localhost;INSTANCE=sde:postgresql:localhost;DBCLIENT=postgresql;DB_CONNECTION_PROPERTIES=localhost;DATABASE=gdbname;USER=sde;VERSION=sde.Dev;AUTHENTICATION_MODE=DBMS",
    "connectionString": "ENCRYPTED_PASSWORD=xxxxx;SERVER=servername;INSTANCE=sde:postgresql:servername;DBCLIENT=postgresql;DB_CONNECTION_PROPERTIES=servername;DATABASE=gdbname;USER=sde;VERSION=sde.Dev;AUTHENTICATION_MODE=DBMS"

I also have a similar data store registered that points to the DEFAULT version of the same enterprise geodatabase (i.e., the same parameters as as above, but replace '/enterpriseDatabases/gdbname_dev' with '/enterpriseDatabases/gdbname', and 'sde.Dev' with 'sde.DEFAULT').  When I publish the geoprocessing service after having run the tool using the SDE connection file configured to point to sde.Dev as the input workspace, and after everything validates fine in the service editor, the published service ends up pointing to sde.DEFAULT instead.  I can confirm this by finding the connection file in the arcgisserver/directories/arcgissystem/... path.

If I remove the registered data store that points to the DEFAULT version of geodatabase, it will use the correct connection when published.

Map services do not seem to have the same problem (I can have both versions of geodatabases registered, and published services will still point to the sde.Dev version of the workspace when appropriate).