1

I am trying to insert records from an FGDB featureclass into an "ArcFM-ified" SDE(Oracle 11g) feature class with a stand alone python script. I want the AutoUpdaters on that feature class to fire. I have downloaded and looked at the examples on Schneider's exchange site. I have also seen the few other questions on here like Objects in this class cannot be updated outside an edit session inside ArcFM?

According to what I have read I need to checkout an ArcFM license, set the

mmAutoUpdaterMode = mmAutoUpdaterMode.mmAUMStandAlone

and when I run the script the auto updaters should fire.

I run my script, the records are successfully inserted into the feature class, but no AutoUpdaters are fired.

Why are they not firing?

I am using arcpy.InsertCursor because I could not get arcpy.da.InsertCursor to work and it was suggested in this post on Schneider's exchange site.

Here is my code:

import arcpy
import os
from arcgisscripting import create
from win32com.client import Dispatch
gp = create(10.1)

app = Dispatch('Miner.Framework.Dispatch.MMAppInitializeDispatch') 
au = Dispatch('Miner.Framework.Dispatch.MMAutoupdaterDispatch')
runtime = Dispatch('Miner.Framework.Dispatch.MMRuntimeEnvironmentDispatch')

from enumerations import mmRuntimeMode,mmLicensedProductCode,mmAutoUpdaterMode  

runtime.RuntimeMode = mmRuntimeMode.mmRuntimeModeArcServer
app.Initialize(mmLicensedProductCode.mmLPArcFM) 
au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMStandAlone

sde_conn = r"C:\Users\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\GDB.sde"
target_fc = os.path.join(sde_conn, 'Schema.FeatureDataset', 'FeatureClass')
source_fc = r'C:\FGDB.gdb\FeatureClass'

feature_list = []
fields = [
          'RECORDID',
          'SHAPE@',
          'SUBTYPECD',
         ]

def populateList():
    with arcpy.da.SearchCursor(source_fc, fields) as scur: 
        for row in scur:
            feature_list.append(row)

def sampleArcFM():
    # code for geoprocessing goes here
    editor = arcpy.da.Editor(sde_conn)
    editor.startEditing(False, True)
    editor.startOperation()

    icur = arcpy.InsertCursor(target_fc) 
    for rec in gen_list:
        row = icur.newRow()
        rec_id = rec[0]
        shape = rec[1]
        subtype = rec[2]
        row.setValue("RECORDID", rec_id)
        row.setValue("SUBTYPECD", subtype)
        row.shape = shape.firstPoint
        icur.insertRow(row)

    editor.stopOperation()
    editor.stopEditing(True)

    del icur

    app.Shutdown
    del app, runtime, au

populateList()
sampleArcFM()
  • Where is gen_list created? I would have expected runtime,au, and app to be referenced by the cursor somehow, otherwise you initialize them but don't use them? Is that how it works with ArcFM? – Midavalo May 21 '17 at 6:03
  • Is this running with 32 bit python? – Midavalo May 21 '17 at 6:10
  • gen_list should be feature_list that is created above fields. I made the changes in the above code. From what I know the cursor doesn't need to reference runtime, au, and app. It is running 32 bit python. – bighill May 21 '17 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.