Skip to main content
1 of 4
Richard Morgan
  • 2.8k
  • 1
  • 22
  • 29

Insert (or Update) Cursor setting value to None not honored when field has a default value

To set a field to null, the InsertCursor or UpdateCursor is setting the value to None. Here is a sample for the UpdateCursor:

with arcpy.da.UpdateCursor(test_fc, ['SERVICEINDICATOR'], """"OBJECTID" = 1""") as uCur:
for row in uCur:
    row[0] = None
    uCur.updateRow(row)

The field allows nulls but has a default value. When setting the value to null, it always sets to the default.

In other words, if the default is 'N', setting the field to None results in the row having 'N'.

How can the cursors respect the None/Null request?

This is an Oracle SDE database (so the answer to arcpy.UpdateCursor setting value to 0 instead of Null does not apply) and ArcMap 10.1

Richard Morgan
  • 2.8k
  • 1
  • 22
  • 29