Select to view content in your preferred language

Webtool with registered data source

391
2
05-16-2023 09:44 PM
Zoggo
by
New Contributor III

I'm publishing a webtool to our portal server. In the webtool i'm coping multiple feature classes pack them in a zip file and use this path for as output paramter for a later download. If I'm using my webtool with one feature class it works fine:

source = os.path.join(r"G:\1_Projekte\ALG\SDE-Connections\AGIS_309_U_ALG_APP.sde","AGIS_309_Prod.U_ALG_APP.alg_floraapp_saatgut_edit_f")
    print(source)
    gp.AddMessage(source)
    arcpy.FeatureClassToGeodatabase_conversion([source],str(gdbPath))
    gp.AddMessage("Data copied")

 

If I try to advance the script to multiple feature classe like this it fails on the server. The paths to the registered enterprise geodatabase is not resolved:

sources = []
sources.append(os.path.join(r"G:\1_Projekte\ALG\SDE-Connections\AGIS_309_U_ALG_APP.sde","AGIS_309_Prod.U_ALG_APP.alg_floraapp_massnahm_edit_f"))
sources.append(os.path.join(r"G:\1_Projekte\ALG\SDE-Connections\AGIS_309_U_ALG_APP.sde","AGIS_309_Prod.U_ALG_APP.alg_floraapp_saatgut_edit_f"))

scratchFolder = arcpy.env.scratchFolder

uid = uuid.uuid4().hex
tempPath = Path(scratchFolder).joinpath(uid)
if not tempPath.exists():
    tempPath.mkdir()

gdbPath = arcpy.CreateFileGDB_management(str(tempPath), "{0}.gdb".format("floraapp"))

arcpy.FeatureClassToGeodatabase_conversion(sources,str(gdbPath))

 

I also tried to iterate over the workspace like this. It failed too on the server:

    arcpy.env.workspace = 'G:/1_Projekte/ALG/SDE-Connections/AGIS_309_U_ALG_APP.sde'
    gp.AddMessage(str(arcpy.env.workspace))
    names = []
    names.append("AGIS_309_Prod.U_ALG_APP.alg_floraapp_massnahm_edit_f")
    names.append("AGIS_309_Prod.U_ALG_APP.alg_floraapp_saatgut_edit_f")
    sources = []
    for fc in arcpy.ListFeatureClasses():
        if str(fc) in names:
            sources.append(fc)

    scratchFolder = arcpy.env.scratchFolder
    print(scratchFolder)

 

The output from line 2 is expected to be be a path to the registered connections but looks like this:

D:\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\ALG\\DownloadFloraAppDataToFGDB.GPServer\\extracted\\p30

0 Kudos
2 Replies
sxw_eaglegis
Esri Contributor

Hi there,

Just checking if "G:\1_Projekte\ALG\SDE-Connections\AGIS_309_U_ALG_APP.sde" is registered as a data source with ArcGIS Enterprise and the account running ArcGIS Server has read access to that location? Is that G drive not located on the server where ArcGIS Enterprise is running?

When you published the tool, did it prompt to copy data when publishing?

0 Kudos
Zoggo
by
New Contributor III

The G-Drive is a local Drive and not located on the server. "G:\1_Projekte\ALG\SDE-Connections\AGIS_309_U_ALG_APP.sde" is a registered data source und the data won't be copied to the server.

0 Kudos