4

I was wondering if there is any way to protect fields so that users cannot delete or edit them. With that being said, a 'superuser' would need to be able to edit and delete at will.

working in python with arcpy; arcgis 10.3

  • 2
    this is possible with SDE databases and user connections/roles, I'm not aware of this capability in file or personal geodatabases – maverickGIS Jan 4 '17 at 19:51
  • 1
    I wasn't thinking so. I know shape_area and shape_length are locked down and I was hoping to be able to do the same to others. – D_C Jan 4 '17 at 20:24
  • 1
    I believe geometry attributes are only locked in the sense that they are derived from the geometry and so change with spatial edits. Maybe using a viewer software is a good alternative for certain users? – maverickGIS Jan 4 '17 at 20:37
1

When creating a field in a FGDB, you can mark it as required which will not allow you to delete it.

>>> gdb = arcpy.CreateFileGDB_management('C:/temp', 'temp')[0]
>>> table = arcpy.CreateTable_management(gdb, 'table')[0]
>>> arcpy.AddField_management(table, 'a', field_is_required=True)    
>>> arcpy.DeleteField_management(table, 'a')

Runtime error 
Traceback (most recent call last):  
File "<string>", line 1, in <module>  
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 3479, in DeleteField     raise e ExecuteError:
Failed to execute.
Parameters are not valid.
ERROR 001334: Cannot delete required field a
Failed to execute (DeleteField).

From the help on Add Field:

Fields set as required are permanent and you will not be able to delete them with future processing. To allow for deletion at a later time set the field to non-required (the default).

  • Couldn't you place the table of protected data in a folder where only the superuser has read/write permissions, then join the tables together? – GBG Jan 5 '17 at 18:23
  • a lot of overhead, but I guess that's a way around it. – D_C Jan 6 '17 at 20:00
  • I think the provided answer is about as close as I am going to get. I would like to be able to do this outside of geodatabases but it does not look possible. – D_C Jan 6 '17 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.