pyarrow.flight.FlightServerBase

class pyarrow.flight.FlightServerBase(location=None, auth_handler=None, tls_certificates=None, verify_client=None, root_certificates=None, middleware=None)

Bases: pyarrow.lib._Weakrefable

A Flight service definition.

Override methods to define your Flight service.

Parameters
locationstr, tuple or Location optional, default None

Location to serve on. Either a gRPC URI like grpc://localhost:port, a tuple of (host, port) pair, or a Location instance. If None is passed then the server will be started on localhost with a system provided random port.

auth_handlerServerAuthHandler optional, default None

An authentication mechanism to use. May be None.

tls_certificateslist optional, default None

A list of (certificate, key) pairs.

verify_clientbool optional, default False

If True, then enable mutual TLS: require the client to present a client certificate, and validate the certificate.

root_certificatesbytes optional, default None

If enabling mutual TLS, this specifies the PEM-encoded root certificate used to validate client certificates.

middlewarelist optional, default None

A dictionary of ServerMiddlewareFactory items. The keys are used to retrieve the middleware instance during calls (see ServerCallContext.get_middleware()).

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

do_action(self, context, action)

do_exchange(self, context, descriptor, ...)

do_get(self, context, ticket)

do_put(self, context, descriptor, reader, ...)

get_flight_info(self, context, descriptor)

get_schema(self, context, descriptor)

list_actions(self, context)

list_flights(self, context, criteria)

run(self)

serve(self)

Start serving.

shutdown(self)

Shut down the server, blocking until current requests finish.

wait(self)

Block until server is terminated with shutdown.

Attributes

port

Get the port that this server is listening on.

do_action(self, context, action)
do_exchange(self, context, descriptor, reader, writer)
do_get(self, context, ticket)
do_put(self, context, descriptor, reader, FlightMetadataWriter writer: FlightMetadataWriter)
get_flight_info(self, context, descriptor)
get_schema(self, context, descriptor)
list_actions(self, context)
list_flights(self, context, criteria)
port

Get the port that this server is listening on.

Returns a non-positive value if the operation is invalid (e.g. init() was not called or server is listening on a domain socket).

run(self)
serve(self)

Start serving.

This method only returns if shutdown() is called or a signal a received.

shutdown(self)

Shut down the server, blocking until current requests finish.

Do not call this directly from the implementation of a Flight method, as then the server will block forever waiting for that request to finish. Instead, call this method from a background thread.

wait(self)

Block until server is terminated with shutdown.