gpf.cursors module¶
This module contains fast and user-friendly alternatives to Esri’s standard cursors. The SearchCursor, InsertCursor and UpdateCursor listed here inherit from Esri’s Data Access cursors, but there are some differences:
- SearchCursors return
_Row
wrappers and have agetValue()
function, similar to Esri’s legacy rows;- Insert- and UpdateCursors return
_MutableRow
wrappers that also have asetValue()
function, similar to their legacy predecessors;- The ported
getValue()
function can return a default value when the field was not found (in the legacy function, it would raise an exception);- The cursors where_clause argument also accepts a
gpf.tools.queries.Where
instance.
In theory, one should be able to simply replace the legacy Esri cursors (in an old script, for example) with the ones in this module without too much hassle, since all legacy methods have been ported to the cursors in this module. The only thing you might need to replace and verify for compatibility is the initialization of the cursor itself.
Please refer to Esri’s documentation on the legacy cursors for the ported functions and the Data Access classes for cursor initialization and function overrides.