Skip to main content

Hi,

I'm trying to write existing features into a relationship class with the new SDE writer. My source and destination features already exist, and I want to populate the relationship class with the known PK of each features, but it seems impossible with this writer. I follow this article : https://knowledge.safe.com/articles/28340/working-with-geodatabase-relationship-classes-atta.html, but it seems we can only write to relationship class if we also write the corresponding features in their tables.

Is there any way to write to a relationship class like a regular table?

Thanks

Hello @arxit - Currently with the SDE geodatabase writer, you do need to have the features which participate in the relationship coming in and being written at the same time as you are writing to the relationship table. It has to validate those relationships.


Hi,

Is this in the roadmap, so we can only use 1 writer to write to feature class and also existing relationships?


Hello @arxit - I was incorrect, if you have an attributed or M:N (attributed or not) relationship which is already set up in the database, and you have the features that participate in the relationship already loaded, you use FME to build the relationships and insert them into the relationship table without writing the features. In order to do this you need to get the OBJECTID's for the feature classes that participate in the relationship (read the feature classes in) and set the OBJECTID from your origin feature class to the geodb_rel_origin_oid and the OBJECTID from the destination feature class to geodb_rel_destination_oid. You also need to make sure you have the geodb_type attribute set to geodb_relationship or geodb_attributed_relationship. This method only works with the OBJECTID's. I hope this makes sense and sorry for the incorrect information at first. My tests yesterday involved foreign and primary keys (which won't work this way), not OBJECTID's. I have uploaded an example workspace showing the attributes which need to be set.simplemnrelationshipsample.fmw


Good this worked!

Actually I have my relationships based on GlobalIDs, so I need the corresponding OBJECTIDs to enter the writer. It's tricky but it works.

Thanks


Good this worked!

Actually I have my relationships based on GlobalIDs, so I need the corresponding OBJECTIDs to enter the writer. It's tricky but it works.

Thanks

Great @arxit - I'm glad it worked for you!

 


Reply