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:
pyarrow.lib._Weakrefable
A client to a Flight service.
Connect to a Flight service on the given host and port.
- Parameters
location (str, 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_certs (bytes 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_hostname (str or None) – Override the hostname checked by TLS. Insecure, use with caution.
middleware (list optional, default None) – A list of ClientMiddlewareFactory instances.
write_size_limit_bytes (int 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_verification (boolean 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_options (list 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)¶
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(*args, **kwargs)Initialize self.
authenticate
(self, auth_handler, …)Authenticate to the server.
authenticate_basic_token
(self, username, …)Authenticate to the server with HTTP basic authentication.
connect
(type cls, location[, …])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.
- authenticate(self, auth_handler, FlightCallOptions options: FlightCallOptions = None)¶
Authenticate to the server.
- Parameters
auth_handler (ClientAuthHandler) – The authentication mechanism to use.
options (FlightCallOptions) – Options for this call.
- authenticate_basic_token(self, username, password, FlightCallOptions options: FlightCallOptions = None)¶
Authenticate to the server with HTTP basic authentication.
- Parameters
username (string) – Username to authenticate with
password (string) – Password to authenticate with
options (FlightCallOptions) – Options for this call
- Returns
tuple (Tuple[str, str]) – A tuple representing the FlightCallOptions authorization header entry of a bearer token.
- connect(type cls, location, tls_root_certs=None, cert_chain=None, private_key=None, override_hostname=None, disable_server_verification=None)¶
- do_action(self, action, FlightCallOptions options: FlightCallOptions = None)¶
Execute an action on a service.
- Parameters
action (str, tuple, or Action) – Can be action type name (no body), type and body, or any Action object
options (FlightCallOptions) – RPC options
- Returns
results (iterator of Result values)
- do_exchange(self, FlightDescriptor descriptor: FlightDescriptor, FlightCallOptions options: FlightCallOptions = None)¶
Start a bidirectional data exchange with a server.
- Parameters
descriptor (FlightDescriptor) – A descriptor for the flight.
options (FlightCallOptions) – RPC options.
- Returns
writer (FlightStreamWriter)
reader (FlightStreamReader)
- do_get(self, Ticket ticket: Ticket, FlightCallOptions options: FlightCallOptions = None)¶
Request the data for a flight.
- Returns
reader (FlightStreamReader)
- do_put(self, FlightDescriptor descriptor: FlightDescriptor, Schema schema: Schema, FlightCallOptions options: FlightCallOptions = None)¶
Upload data to a flight.
- Returns
writer (FlightStreamWriter)
reader (FlightMetadataReader)
- 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.
- wait_for_available(self, timeout=5)¶
Block until the server can be contacted.
- Parameters
timeout (int, default 5) – The maximum seconds to wait.