I need to select a SDE PATH based on user selection on Python toolbox at ArcGIS Pro 2.7.1 and use this path
at the code for setting like
fc = 'Zone'
SDEDir = inputPath
arcpy.management.CalculateField(r"F:\\Pro\\AreaProject\\SEV_SDE.sde\\" + fc,
"PROJECTT",
....
"PYTHON")
so the final code looks like
fc = 'Zone'
SDEDir = inputPath
arcpy.management.CalculateField(SDEDir + fc,
"PROJECTT",
....
"PYTHON")
Can you please let me know what data type I can use to grab the selected SDE Path? I already used File and Database Connection but they are not giving me the PATH
Solved! Go to Solution.
Use a workspace and specify a remote database filter. For a python toolbox (.pyt) this is:
import os
import arcpy
etc...
class Tool(object):
etc...
def getParameterInfo(self):
param0 = arcpy.Parameter(
displayName="Input Workspace",
name="in_workspace",
datatype="DEWorkspace",
parameterType="Required",
direction="Input")
# Set the filter to accept only remote/enterprise geodatabases
param0.filter.list = ["Remote Database"]
return [param0]
def execute(self, parameters, messages):
"""The source code of the tool."""
path = parameters[0].valueAsText
fc = "Zone"
fc_path = os.path.join(path, fc)
Use a workspace and specify a remote database filter. For a python toolbox (.pyt) this is:
import os
import arcpy
etc...
class Tool(object):
etc...
def getParameterInfo(self):
param0 = arcpy.Parameter(
displayName="Input Workspace",
name="in_workspace",
datatype="DEWorkspace",
parameterType="Required",
direction="Input")
# Set the filter to accept only remote/enterprise geodatabases
param0.filter.list = ["Remote Database"]
return [param0]
def execute(self, parameters, messages):
"""The source code of the tool."""
path = parameters[0].valueAsText
fc = "Zone"
fc_path = os.path.join(path, fc)