I'm trying to delete rows in a hosted layer by searching my local layer to feed an update cursor. I'm hitting an error claiming "AttributeError: 'Polygon' object has no attribute 'FACILITYID'". Below is my current code:
arcpy.env.overwriteOutput = True
# Create GIS object
gis = GIS('https://www.arcgis.com', username, password)
print("Logged in as " + str(gis.properties.user.username))
#lyr that will be search cursored
lyrSearch = r"C:\blahblah\JOINED_STRUCTURES_1"
#Hosted Layer Item ID
fsItemId = "2e1f37aab41746afacfcf7c8534384e8"
#lyr that will be inserted into
lyrInsert = gis.content.get(fsItemId)
#needs to point directly to the layer in the Feature Service
tableInsert = lyrInsert.layers[0].url
print("Got Feature Service")
#a list of the fields needed to be loaded
fieldNames = ['SHAPE@', 'FACILITYID', 'ADDRESS', 'Editor', 'COMMENTS', 'ADDRESS', 'CITY', 'STATE', 'ZIP', 'DISPLAYOWNERNAME', 'CROSSBORESTATUS', 'CROSSBORECOMMENT', 'REPAIRSTATUS', 'ContractorName', 'Static_FacilityID']
#Update function
uCurs = arcpy.da.UpdateCursor(tableInsert, 'FACILITYID')
#cursor for searching and then feeding uCurs
n = 0
with arcpy.da.SearchCursor(lyrSearch, fieldNames) as sCurs:
for row in sCurs:
if row[0].FACILITYID == sCurs:
uCurs.deleteRow(row)
n +=1
continue
print("Deleted " + str(n))
print('FIN')If I remove the .FACILITYID in line 30 and just have "row[0] == sCurs:", then the script will run through, but not delete anything. Any suggestions?