Skip to main content

Hi

So before anything I've been browsing this topics for a week now, with no solution in sight.

An error occurred while attempting to open an insert cursor on the table 'XXXX'. The error number from ArcObjects is: '-2147216556'. The error message from ArcObjects is: {Objects in this class cannot be updated outside an edit session aXXXX]}
A fatal error has occurred. Check the logfile above for details 

What i've been trying:

Change Transaction type to: 1: Versioned Edist Session, 2:Non- versioned Edit Session, 3: Transactions, 4:None

Delete all attributes on a given feature to see if some was causing trouble

Override username, password with the sde user

Checking that there are no locks on the feature

Asserting correct FeatureClass or table Name

Asserting correct FeatureClass or table Qualifier

Asserting correct Feature Dataset

Asserting correct geometry type

Drop Table (yes and no)

Truncate table (yes and no)

Tried setting the attribute geodb_feature_dataset manually with correct values

And lastly toggle all advance options on the feature writer.

And for a last information the topology is enabled for the feature dataset I'm trying to write to.

I have also tried to recreate the sde connection file

I tried to create a new version in the ArcCatalog and create an sde connection file that points to the new version

Please anyone who can point me in the right direction to solve this will be highly appreciated :)

The database is MSSQL

 

 


Is your feature class maybe part of a topology definition or something similar?


Is your feature class maybe part of a topology definition or something similar?

 

Yes it is.

 

Yes it is.
Ah yes, sorry I didn't see that at first.

 

I think your only option is to delete the topology definition first, write the data, then recreate the topology definition again.

 

At least I do not know of any other options.

Is your feature class maybe part of a topology definition or something similar?

Here is an example of one of the topology definitions.

 

 


Here is an example of one of the topology definitions.

 

 

I've never been able to write to any feature class that was part of a topology defintion with FME, and I'm not sure if it's possible at all, regardless of how the topology has been configured.

 

 


I've never been able to write to any feature class that was part of a topology defintion with FME, and I'm not sure if it's possible at all, regardless of how the topology has been configured.

 

 

Thanks alot for your comment. Then i know for sure this has to do with the feature class beeing part of a topology definition. I will try to write a script the removes the feature class from the topology. and maybe write a script that recreates the topology at shutdown. I will post the answer if I manage i, if I don't there will be silence. Hehe

 

 


Thanks alot for your comment. Then i know for sure this has to do with the feature class beeing part of a topology definition. I will try to write a script the removes the feature class from the topology. and maybe write a script that recreates the topology at shutdown. I will post the answer if I manage i, if I don't there will be silence. Hehe

 

 

I'm sure there will be a lot of grateful people if you find a solution and share it here!

Ok, so these are the steps need for writing to an SDE with topology enabled:

I don't know why there is no transformers for this operation, but its quite simple.

First I have located where my featureclass is beeing part of a topology

And this is the hardcoded python script:

import fme 
import fmeobjects 
import arcpy 
from arcpy import env

topology = r"H:\my_sde_connections\my.sde\my_feature_dataset\my_topology" 
featureclass = r"my_featureclass"

class FeatureProcessor(object):
     def __init__(self):
# its placed in init cause we only want it to be run once and before any feature enters the writer
         try:
             arcpy.RemoveFeatureClassFromTopology_management(topology, featureclass)
         except Exception:
             pass
     def input(self,feature):
         self.pyoutput(feature)
     def close(self):
         pass 


# This is not code #
Sh.. I don't know how to exit code snippet.

the we send every feature through the FeatureWriter

and to another pythonCaller:


import fme
import fmeobjects
import arcpy
from arcpy import env

env.workspace = r"H:\my_sde_connections\my.sde
topology = r"H:\my_sde_connections\my.sde\my_feature_dataset\my_topology" 
featureclass = r"my_featureclass"

class FeatureProcessor(object):
    def __init__(self):
        arcpy.AddFeatureClassToTopology_management(topology, featureclass, 1, 1) 
# here ranks are just set to 1
    def input(self,feature):
        self.pyoutput(feature)
    def close(self):
        pass


This add the featureclass back to the topology

any rules that were on the featureclass is gone, but I think it can be hardcoded back, maybe dynamically by asking for the first and storing them as attributes?


Ok, so these are the steps need for writing to an SDE with topology enabled:

I don't know why there is no transformers for this operation, but its quite simple.

First I have located where my featureclass is beeing part of a topology

And this is the hardcoded python script:

import fme 
import fmeobjects 
import arcpy 
from arcpy import env

topology = r"H:\my_sde_connections\my.sde\my_feature_dataset\my_topology" 
featureclass = r"my_featureclass"

class FeatureProcessor(object):
     def __init__(self):
# its placed in init cause we only want it to be run once and before any feature enters the writer
         try:
             arcpy.RemoveFeatureClassFromTopology_management(topology, featureclass)
         except Exception:
             pass
     def input(self,feature):
         self.pyoutput(feature)
     def close(self):
         pass 


# This is not code #
Sh.. I don't know how to exit code snippet.

the we send every feature through the FeatureWriter

and to another pythonCaller:


import fme
import fmeobjects
import arcpy
from arcpy import env

env.workspace = r"H:\my_sde_connections\my.sde
topology = r"H:\my_sde_connections\my.sde\my_feature_dataset\my_topology" 
featureclass = r"my_featureclass"

class FeatureProcessor(object):
    def __init__(self):
        arcpy.AddFeatureClassToTopology_management(topology, featureclass, 1, 1) 
# here ranks are just set to 1
    def input(self,feature):
        self.pyoutput(feature)
    def close(self):
        pass


This add the featureclass back to the topology

any rules that were on the featureclass is gone, but I think it can be hardcoded back, maybe dynamically by asking for the first and storing them as attributes?

Excellent, thanks for sharing :-)
Excellent, thanks for sharing :-)
I don't recomend this. Its highly painful to recreate complex rules. And as far as I can see, arcpy delivers no module or function for loading a .rul file, so it looks like everything must be written in the code. I'm gonna vote for a transformer that does this.

 

 


Reply