GeoEco.Datasets.InsertCursor
- class GeoEco.Datasets.InsertCursor(dataset, rowCount, reportProgress, rowDescriptionSingular, rowDescriptionPlural)
Bases:
_CursorBase class for forward-only cursors used to insert rows into a
Table.Not all
Tables support insert cursors. To determine if aTableinstance supports insert cursors, call itsTestCapability()method with a capability of'InsertCursor'.This class is not meant to be instantiated directly. Instead call
Table.OpenInsertCursor(). After obtaining anInsertCursorinstance, callSetValue()andSetGeometry()to set the values of the first row and then callInsertRow()to insert it. Repeat this pattern until you are finished inserting rows. Then close the cursor either by releasing all references to theInsertCursorinstance or by explicitly calling itsClose()method.If you do not explicitly set values of all of a new row’s fields by calling
SetValue()prior to callingInsertRow(), those fields will be set to database NULL (if they are not read-only). If a field that has not been set is not nullable,InsertRow()will report an error. To determine if a field is nullable, callGetFieldByName()on theTableand examine theIsNullableproperty of the returnedFieldinstance.Certain storage formats may implement a transactional updating scheme in which changes will not be committed to the underlying data store until the cursor has been closed. For more information, please see the documentation for the particular kind of
Tableyou are working with.The typical pattern for using
InsertCursorlooks like this:with table.OpenInsertCursor(...) as cursor: for ...: # Loop over new rows, inserting one at a time cursor.SetValue(...) ... cursor.InsertRow()
Properties
- property RowDescriptionPlural
(
str) Word to use in progress and error messages for plural rows. If not supplied when the cursor was opened, an appropriate generic word will be automatically selected based on table’s geometry type, such as “points”, “lines”, “polygons”, and so on. If the table does not have geometry, “rows” will be used. Read only. Minimum length꞉ 1.
- property RowDescriptionSingular
(
str) Word to use in progress and error messages for a single row. If not supplied when the cursor was opened, an appropriate generic word will be automatically selected based on the table’s geometry type, such as “point”, “line”, “polygon”, and so on. If the table does not have geometry, “row” will be used. Read only. Minimum length꞉ 1.
Methods
Closes the cursor.
Submits the new row to the underlying data store.
Sets the geometry of the new row.
Sets the number of rows that this cursor is expected to process.
Sets the value of a field of the new row, given the name of the field and its value.