MCPcopy Create free account
hub / github.com/apache/arrow / test_flight_do_put_metadata

Function test_flight_do_put_metadata

python/pyarrow/tests/test_flight.py:1859–1878  ·  view source on GitHub ↗

Try a simple do_put call with metadata.

()

Source from the content-addressed store, hash-verified

1857
1858
1859def test_flight_do_put_metadata():
1860 """Try a simple do_put call with metadata."""
1861 data = [
1862 pa.array([-10, -5, 0, 5, 10])
1863 ]
1864 table = pa.Table.from_arrays(data, names=['a'])
1865
1866 with MetadataFlightServer() as server, \
1867 FlightClient(('localhost', server.port)) as client:
1868 writer, metadata_reader = client.do_put(
1869 flight.FlightDescriptor.for_path(''),
1870 table.schema)
1871 with writer:
1872 for idx, batch in enumerate(table.to_batches(max_chunksize=1)):
1873 metadata = struct.pack('<i', idx)
1874 writer.write_with_metadata(batch, metadata)
1875 buf = metadata_reader.read()
1876 assert buf is not None
1877 server_idx, = struct.unpack('<i', buf.to_pybytes())
1878 assert idx == server_idx
1879
1880
1881@pytest.mark.numpy

Callers

nothing calls this directly

Calls 8

FlightClientClass · 0.90
to_batchesMethod · 0.80
arrayMethod · 0.45
do_putMethod · 0.45
packMethod · 0.45
readMethod · 0.45
unpackMethod · 0.45

Tested by

no test coverage detected