We're trying to run a script in FME Server 2018 that replaces a geodatabase with a new dataset using arcpy. In a few months we'll be attempting to use FME's native geodatabase writer, but for now I need to troubleshoot why the following doesn't work:
import fme
import fmeobjects
import arcpy
# Main Function
def delme(feature):
# Variables
table_2b_deld = feature.getAttribute('SOURCE_ETL_TABLE')
sde_conn = FME_MacroValues['SDE_Connection']
full_del_str = sde_conn + '\\' + table_2b_deld + 'X'
# print full_del_str
# Process
try:
arcpy.Delete_management(full_del_str)
feature.setAttribute('deletion_result','success')
except Exception, e:
logger = fmeobjects.FMELogFile()
logger.logException(e,2)
feature.setAttribute('deletion_result','failure')
feature.setAttribute('deletion_result_detail',e)
pass
After that script runs, we move data in Oracle from our staging schema into our production schema, then attempt a geodatabase registration script with a virtually identical syntax.
If the geodatabase isn't there already, the script works perfectly well. If the geodatabase is already there, it fails with the following log message:
2018-06-06 12:10:19| 21.5| 0.1|WARN |Failed to execute. Parameters are not valid.
ERROR 001050: Either registered with geodatabase already or cannot open the dataset.
Failed to execute (RegisterWithGeodatabase).
2018-06-06 12:10:19| 21.5| 0.0|ERROR |Python Exception <TypeError>: Could not convert attribute value to a supported attribute type.
2018-06-06 12:10:19| 21.5| 0.0|ERROR |Error encountered while calling function `regme'
2018-06-06 12:10:19| 21.5| 0.0|FATAL |Register_X_Table(PythonFactory): PythonFactory failed to process feature
2018-06-06 12:10:19| 21.5| 0.0|ERROR |A fatal error has occurred. Check the logfile above for details
2018-06-06 12:10:19| 21.5| 0.0|ERROR |... Last line repeated 3 times ...
2018-06-06 12:10:19| 21.5| 0.0|ERROR |Bridge failed to output feature on tag `PYOUTPUT'
2018-06-06 12:10:19| 21.5| 0.0|FATAL |Delete_X_Table(PythonFactory): PythonFactory failed to process feature
2018-06-06 12:10:19| 21.5| 0.0|ERROR |A fatal error has occurred. Check the logfile above for details
The error log is showing that both python scripts generated a fatal error.