Class: QgsArrowIterator

Wrapper for an Arrow reader of features from vector data provider or vector layer.

Added in version 4.0.

Methods

nextFeatures

Build an ArrowArray using the next n features (or fewer depending on the number of features remaining)

setSchema

Set the ArrowSchema for the output of all future batches

Static Methods

inferSchema

Infer the QgsArrowSchema for a given QgsVectorLayer

class qgis.core.QgsArrowIterator[source]

Bases: object

__init__()

Construct invalid iterator

__init__(featureIterator: QgsFeatureIterator)

Construct iterator from an existing feature iterator

Parameters:

featureIterator (QgsFeatureIterator)

__init__(a0: QgsArrowIterator)
Parameters:

a0 (QgsArrowIterator)

static inferSchema(layer: QgsVectorLayer, options: QgsArrowInferSchemaOptions = QgsArrowInferSchemaOptions()) QgsArrowSchema[source]

Infer the QgsArrowSchema for a given QgsVectorLayer

Raises:

QgsException – if one or more attribute fields is of an unsupported type.

Parameters:
Return type:

QgsArrowSchema

static inferSchema(fields: QgsFields, hasGeometry: bool = False, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem(), options: QgsArrowInferSchemaOptions = QgsArrowInferSchemaOptions()) QgsArrowSchema[source]

Infer the QgsArrowSchema from components

Raises:

QgsException – if one or more attribute fields is of an unsupported type.

Parameters:
Return type:

QgsArrowSchema

nextFeatures(self, n: int) QgsArrowArray[source]

Build an ArrowArray using the next n features (or fewer depending on the number of features remaining)

If no features remain, the returned array will be invalid (i.e., isValid() will return False).

Raises:

QgsException – if a feature’s attribute cannot be appended to an ArrowArray of the requested type or on internal error when building the array.

Parameters:

n (int)

Return type:

QgsArrowArray

setSchema(self, schema: QgsArrowSchema)[source]

Set the ArrowSchema for the output of all future batches

This must be set before calling nextFeatures().

Parameters:

schema (QgsArrowSchema)