AnsweredAssumed Answered

Write to Feature Class and Related Table

Question asked by jay.kapalczynski on Apr 22, 2020
Latest reply on Apr 22, 2020 by jay.kapalczynski

I have a Feature Class and a Table and a Relationship Class relating them via GlobalID

 

I want to write to the Feature Class (geometry and a couple attributes)

I also want to write to the related table (few attributes)

 

Are there any simple examples of how to write to them via arcPy?

 

I can write to the Feature Class like the below BUT how do I write to the related Table at the same time?

 

    workspace = r"E:/ArcGISProjects/CountySelection/cccc.sde"
    edit = arcpy.da.Editor(workspace)
    # Edit session is started without an undo/redo stack for versioned data
    #  (for second argument, use False for unversioned data)
    edit.startEditing(False, False)
    print "edit started"
    # Create update cursor
    with arcpy.da.InsertCursor(inputFeatureclass, ['SHAPE@', 'ADDRESSgeocode', 'DISTANCEparameter', 'UNIQUEIDparameter', 'COUNTYLIST', 'ID']) as cursor:
        # Start an edit operation
        edit.startOperation()
        # Perform edits
        ## CREATE THE NEW MULTI PART POLYGON IN THE FC
        cursor.insertRow([geometries[0], searchAddress, searchDistance, searchid, txt_list, validGuid])
        ## Delete cursor object
        del cursor

    # Stop the edit operation.
    edit.stopOperation()
    # Stop the edit session and save the changes
    edit.stopEditing(True)
    print "edit ended"

Outcomes