RecordBatchReader¶
arro3.core.RecordBatchReader ¶
An Arrow RecordBatchReader.
A RecordBatchReader holds a stream of RecordBatch
.
__arrow_c_schema__ ¶
__arrow_c_schema__() -> object
An implementation of the Arrow PyCapsule Interface. This dunder method should not be called directly, but enables zero-copy data transfer to other Python libraries that understand Arrow memory.
This allows Arrow consumers to inspect the data type of this RecordBatchReader.
Then the consumer can ask the producer (in __arrow_c_stream__
) to cast the
exported data to a supported data type.
__arrow_c_stream__ ¶
An implementation of the Arrow PyCapsule Interface. This dunder method should not be called directly, but enables zero-copy data transfer to other Python libraries that understand Arrow memory.
For example, you can call
pyarrow.RecordBatchReader.from_stream
to convert this stream to a pyarrow RecordBatchReader
. Alternatively, you can
call pyarrow.table()
to consume this stream to a pyarrow
table or Table.from_arrow()
to consume this stream to an
arro3 Table.
from_arrow
classmethod
¶
from_arrow(
input: ArrowArrayExportable | ArrowStreamExportable,
) -> RecordBatchReader
Construct this from an existing Arrow object.
It can be called on anything that exports the Arrow stream interface
(has an __arrow_c_stream__
method), such as a Table
or RecordBatchReader
.
from_arrow_pycapsule
classmethod
¶
from_arrow_pycapsule(capsule) -> RecordBatchReader
Construct this object from a bare Arrow PyCapsule
from_batches
classmethod
¶
from_batches(
schema: ArrowSchemaExportable, batches: Sequence[ArrowArrayExportable]
) -> RecordBatchReader
Construct a new RecordBatchReader from existing data.
Parameters:
-
schema
(ArrowSchemaExportable
) –The schema of the Arrow batches.
-
batches
(Sequence[ArrowArrayExportable]
) –The existing batches.
from_stream
classmethod
¶
from_stream(data: ArrowStreamExportable) -> RecordBatchReader
Import a RecordBatchReader from an object that exports an Arrow C Stream.