pyarrow.ipc.RecordBatchStreamWriter#

classpyarrow.ipc.RecordBatchStreamWriter(sink,schema,*,options=None)[source]#

Bases:_RecordBatchStreamWriter

Writer for the Arrow streaming binary format

Parameters:
sinkstr,pyarrow.NativeFile, or file-like Python object

Either a file path, or a writable file object.

schemapyarrow.Schema

The Arrow schema for data to be written to the file.

optionspyarrow.ipc.IpcWriteOptions

Options for IPC serialization.

If None, default values will be used: the legacy format will notbe used unless overridden by setting the environment variableARROW_PRE_0_15_IPC_FORMAT=1, and the V5 metadata version will beused unless overridden by setting the environment variableARROW_PRE_1_0_METADATA_VERSION=1.

__init__(sink,schema,*,options=None)[source]#

Methods

__init__(sink, schema, *[, options])

close(self)

Close stream and write end-of-stream 0 marker.

write(self, table_or_batch)

Write RecordBatch or Table to stream.

write_batch(self, RecordBatch batch[, ...])

Write RecordBatch to stream.

write_table(self, Table table[, max_chunksize])

Write Table to stream in (contiguous) RecordBatch objects.

Attributes

stats

Current IPC write statistics.

close(self)#

Close stream and write end-of-stream 0 marker.

stats#

Current IPC write statistics.

write(self,table_or_batch)#

Write RecordBatch or Table to stream.

Parameters:
table_or_batch{RecordBatch,Table}
write_batch(self,RecordBatchbatch,custom_metadata=None)#

Write RecordBatch to stream.

Parameters:
batchRecordBatch
custom_metadatamapping orKeyValueMetadata

Keys and values must be string-like / coercible to bytes

write_table(self,Tabletable,max_chunksize=None)#

Write Table to stream in (contiguous) RecordBatch objects.

Parameters:
tableTable
max_chunksizeint, defaultNone

Maximum number of rows for RecordBatch chunks. Individual chunks maybe smaller depending on the chunk layout of individual columns.