This directory contains a simple curl
command that:
- Sends an HTTP GET request to a server.
- Receives an HTTP 200 response from the server, with the response body containing an Arrow IPC stream of record batches.
- Writes the stream of record batches to an Arrow IPC stream file with filename
output.arrows
.
To run this example, first start one of the server examples in the parent directory, then run the curl
command.
To read the resulting file output.arrows
and retrieve the schema and record batches that it contains, you can use one of the code examples below, or use similar examples in other languages that have Arrow implementations. You can also read the file with any application that supports reading data in the Arrow IPC streaming format.
Example: Read Arrow IPC stream file with Python
import pyarrow as pa
with open("output.arrows", "rb") as f:
reader = pa.ipc.open_stream(f)
schema = reader.schema
batch = reader.read_next_batch()
# ...
# or alternatively:
batches = [b for b in reader]
Example: Read Arrow IPC stream file with R
library(arrow)
reader <- RecordBatchStreamReader$create(ReadableFile$create("output.arrows"))
schema <- reader$schema
batch <- reader$read_next_batch()
# ...
# or alternatively:
table <- reader$read_table()