Problem with UpdateCursor - cannot updagte table

1592
11
09-15-2023 10:55 AM
MarcSeliger
New Contributor II

Hi all.

I'm running into a problem with an UpdateCursor in arcpy.
As soon as the script is encountering the UpdateCursor line, it ends with an error "Cannot update table".

I can run a SearchCursor over the feature class without problems, just the UpdateCursor fails every time.

This is the (very simplified) code I'm looking at:

connection = "C:\\Users\\user_name\\AppData\\Roaming\\ESRI\\Desktop10.8\\ArcCatalog\\database.gds\\Utilities (VERSION:dbo.DEFAULT)"
fc = "CV_Valves"
fc_path = f"{connection}\\{fc}"

edit = arcpy.da.Editor(connection)
edit.startEditing(False, True)
edit.startOperation()

with arcpy.da.UpdateCursor(fc_path, "OBJECTID") as cursor:
for row in cursor:
print(row[0])
# cursor.updateRow(row)

edit.stopOperation()
edit.stopEditing(True)

I have the updateRow line commented out for testing purposes, and the actual user_name and db name are replaced by placeholders. I realize that the code is not updating anything, and this is just show the error I'm running into. I'm running Python 3.9

I'm not sure if this has something to do with the SDE I'm connecting to, because the code is simple enough where it shouldn't throw any errors. The same procedure works fine when I connect to an SDE DB on a different system. As I mentioned above, I can run a SearchCursor over the same table without any issues.

Any help or pointers would be greatly appreciated.

Thanks!

Mard

Tags (3)
0 Kudos
11 Replies
MarcSeliger
New Contributor II

Thanks for your help Alfred, I will give this a try.

0 Kudos
RogerDunnGIS
Occasional Contributor II

You said it works in one "system" and not another.  Permission questions have already been asked, but you should also look the edition of ArcGIS Pro that one person has vs. the other.  Perhaps one has a Standard license but the other system uses a Basic license.  That would probably throw such an error.

I think I've received "Cannot update table" when one of the text field values was too large, but that wouldn't explain why one system could do it and the other couldn't.

0 Kudos