pyarrow.flight.FlightClient#

class pyarrow.flight.FlightClient(location, tls_root_certs=None, *, cert_chain=None, private_key=None, override_hostname=None, middleware=None, write_size_limit_bytes=None, disable_server_verification=None, generic_options=None)#

Bases: _Weakrefable

A client to a Flight service.

Connect to a Flight service on the given host and port.

Parameters:
locationstr, tuple or Location

Location to connect to. Either a gRPC URI like grpc://localhost:port, a tuple of (host, port) pair, or a Location instance.

tls_root_certsbytes or None

PEM-encoded

cert_chain: bytes or None

Client certificate if using mutual TLS

private_key: bytes or None

Client private key for cert_chain is using mutual TLS

override_hostnamestr or None

Override the hostname checked by TLS. Insecure, use with caution.

middlewarelist optional, default None

A list of ClientMiddlewareFactory instances.

write_size_limit_bytesint optional, default None

A soft limit on the size of a data payload sent to the server. Enabled if positive. If enabled, writing a record batch that (when serialized) exceeds this limit will raise an exception; the client can retry the write with a smaller batch.

disable_server_verificationbool optional, default False

A flag that indicates that, if the client is connecting with TLS, that it skips server verification. If this is enabled, all other TLS settings are overridden.

generic_optionslist optional, default None

A list of generic (string, int or string) option tuples passed to the underlying transport. Effect is implementation dependent.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

as_async(self)

authenticate(self, auth_handler, ...)

Authenticate to the server.

authenticate_basic_token(self, username, ...)

Authenticate to the server with HTTP basic authentication.

close(self)

Close the client and disconnect.

connect(cls, location[, tls_root_certs, ...])

Connect to a Flight server.

do_action(self, action, ...)

Execute an action on a service.

do_exchange(self, ...)

Start a bidirectional data exchange with a server.

do_get(self, Ticket ticket, ...)

Request the data for a flight.

do_put(self, FlightDescriptor descriptor, ...)

Upload data to a flight.

get_flight_info(self, ...)

Request information about an available flight.

get_schema(self, ...)

Request schema for an available flight.

list_actions(self, FlightCallOptions options)

List the actions available on a service.

list_flights(self, bytes criteria, ...)

List the flights available on a service.

wait_for_available(self[, timeout])

Block until the server can be contacted.

Attributes

supports_async

as_async(self) None#
authenticate(self, auth_handler, FlightCallOptions options: FlightCallOptions = None)#

Authenticate to the server.

Parameters:
auth_handlerClientAuthHandler

The authentication mechanism to use.

optionsFlightCallOptions

Options for this call.

authenticate_basic_token(self, username, password, FlightCallOptions options: FlightCallOptions = None)#

Authenticate to the server with HTTP basic authentication.

Parameters:
usernamestr

Username to authenticate with

passwordstr

Password to authenticate with

optionsFlightCallOptions

Options for this call

Returns:
tupleTuple[str, str]

A tuple representing the FlightCallOptions authorization header entry of a bearer token.

close(self)#

Close the client and disconnect.

classmethod connect(cls, location, tls_root_certs=None, cert_chain=None, private_key=None, override_hostname=None, disable_server_verification=None)#

Connect to a Flight server.

Deprecated since version 0.15.0: Use the FlightClient constructor or pyarrow.flight.connect function instead.

do_action(self, action, FlightCallOptions options: FlightCallOptions = None)#

Execute an action on a service.

Parameters:
actionstr, tuple, or Action

Can be action type name (no body), type and body, or any Action object

optionsFlightCallOptions

RPC options

Returns:
resultsiterator of Result values
do_exchange(self, FlightDescriptor descriptor: FlightDescriptor, FlightCallOptions options: FlightCallOptions = None)#

Start a bidirectional data exchange with a server.

Parameters:
descriptorFlightDescriptor

A descriptor for the flight.

optionsFlightCallOptions

RPC options.

Returns:
writerFlightStreamWriter
readerFlightStreamReader
do_get(self, Ticket ticket: Ticket, FlightCallOptions options: FlightCallOptions = None)#

Request the data for a flight.

Returns:
readerFlightStreamReader
do_put(self, FlightDescriptor descriptor: FlightDescriptor, Schema schema, FlightCallOptions options: FlightCallOptions = None)#

Upload data to a flight.

Returns:
writerFlightStreamWriter
readerFlightMetadataReader
get_flight_info(self, FlightDescriptor descriptor: FlightDescriptor, FlightCallOptions options: FlightCallOptions = None)#

Request information about an available flight.

get_schema(self, FlightDescriptor descriptor: FlightDescriptor, FlightCallOptions options: FlightCallOptions = None)#

Request schema for an available flight.

list_actions(self, FlightCallOptions options: FlightCallOptions = None)#

List the actions available on a service.

list_flights(self, bytes criteria: bytes = None, FlightCallOptions options: FlightCallOptions = None)#

List the flights available on a service.

supports_async#
wait_for_available(self, timeout=5)#

Block until the server can be contacted.

Parameters:
timeoutint, default 5

The maximum seconds to wait.