I am trying to delete records via REST Service. the smaller tables delete no issues but Feature Classes with images seem to NOT delete as they have more than 10,000 records
If I look at the ObjectIDs and grab the first half and then the second half they both delete.
But I want this to be automated... So I am trying to think this through... Trying to figure out how to query for the first say 2000 records and then do something... then grab 2001st record through 4000 and do something etc.
Anyone have any ideas?
Im POST like below using a where clause.. so what ever solution would have to have a viable WHERECLAUSE ... not sure how to do this without manually setting the where clause to something like this:
How can I grab my features in CHUCKS
if targetLayer == "GIS_DATA.SDEInventory":
whereclause="{}".format("OBJECTID<15000")
processDeletion(url, whereclause)
whereclause="{}".format("OBJECTID>=15000")
processDeletion(url, whereclause)
def processDeletion(targetLayer, whereclause):
targetFeature = targetLayer
recordstoDelete = whereclause
gis_payload = {
'token': portaltoken,
'f': 'json',
'where': recordstoDelete
}
response = requests.request("POST", url=targetFeature , data=gis_payload)