Class: QgsArrowIterator

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

Added in version 4.0.

List of all members, including inherited members

Constructor

__init__

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.

toArrayStream

Export this iterator as an ArrowArrayStream

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.

inferSchema(fields: QgsFields, hasGeometry: bool = False, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem(), options: QgsArrowInferSchemaOptions = QgsArrowInferSchemaOptions()) -> QgsArrowSchema 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(schema)[source]

Set the ArrowSchema for the output of all future batches.

Accepts either a QgsArrowSchema or any object implementing __arrow_c_schema__() (e.g., pyarrow.Schema).

toArrayStream(self, batchSize: int = 65536) QgsArrowArrayStream[source]

Export this iterator as an ArrowArrayStream

Parameters:

batchSize (int = 65536)

Return type:

QgsArrowArrayStream