Skip to main content

I am trying to run a python script in a PythonCaller to Truncate Features in an Oracle ArcSDE database.

If I run the script and hard code the Feature it runs fine but when I try to use feature.getAttribute to read a list created in a previous transformer, I keep getting:

Python Exception <ExecuteError>: Failed to execute. Parameters are not valid.

ERROR 000187: Only supports Geodatabase tables and feature classes

 

My script is:

# Import arcpy module

import arcpy

 

def processFeature(feature):

IFeatures = ('C:\\\\AppData\\\\Roaming\\\\ESRI\\\\Desktop10.5\\\\ArcCatalog\\\\Connection_to_HYDRA.sde\\\\' + feature.getAttribute('_list{0}'))

 

print (IFeatures)

for mark in IFeatures:

arcpy.TruncateTable_management(mark)

I don't have access to arcpy right now so i'm not 100% sure on setting the environment for sde but normally I'd expect the code to look something like this

 

import arcpy

def processFeature(feature):

    arcpy.env.workspace = "C:\\AppData\\Roaming\\ESRI\\Desktop10.5\\ArcCatalog\\Connection_to_HYDRA.sde"

    IFeatures = feature.getAttribute('_list{}')

    for mark in IFeatures:

        arcpy.TruncateTable_management(mark)

So set the environment, and then get the list (I'm presuming you want all list items, as your posted code only references the first list item (_list{0})


I don't have access to arcpy right now so i'm not 100% sure on setting the environment for sde but normally I'd expect the code to look something like this

 

import arcpy

def processFeature(feature):

    arcpy.env.workspace = "C:\\AppData\\Roaming\\ESRI\\Desktop10.5\\ArcCatalog\\Connection_to_HYDRA.sde"

    IFeatures = feature.getAttribute('_list{}')

    for mark in IFeatures:

        arcpy.TruncateTable_management(mark)

So set the environment, and then get the list (I'm presuming you want all list items, as your posted code only references the first list item (_list{0})

Thanks @ebygomm, that did the job.  I did want all the list items as well. 


Reply