adbc_driver_flightsql

Low-Level API

Low-level ADBC bindings for the Flight SQL driver.

class adbc_driver_flightsql.ConnectionOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Connection options specific to the Flight SQL driver.

OPTION_BOOL_SESSION_OPTION_PREFIX = 'adbc.flight.sql.session.optionbool.'

Get or set a boolean valued session option.

OPTION_ERASE_SESSION_OPTION_PREFIX = 'adbc.flight.sql.session.optionerase.'

Erase a session option (use “” as the value).

OPTION_SESSION_OPTIONS = 'adbc.flight.sql.session.options'

Get all session options as a JSON key-value blob.

OPTION_SESSION_OPTION_PREFIX = 'adbc.flight.sql.session.option.'

Get or set a session option.

OPTION_STRING_LIST_SESSION_OPTION_PREFIX = 'adbc.flight.sql.session.optionstringlist.'

Get or set a string-list-valued session option as a JSON array.

RPC_CALL_HEADER_PREFIX = 'adbc.flight.sql.rpc.call_header.'

Add an arbitrary header to all outgoing requests.

This option should prefix the name of the header to add (i.e. it should be used like f"{ConnectionOptions.RPC_CALL_HEADER_PREFIX}x-my-header").

Overrides any headers set via the equivalent database option.

TIMEOUT_FETCH = 'adbc.flight.sql.rpc.timeout_seconds.fetch'

Set a timeout on calls that fetch data (in floating-point seconds).

This corresponds to Flight RPC DoGet calls.

TIMEOUT_QUERY = 'adbc.flight.sql.rpc.timeout_seconds.query'

Set a timeout on calls that execute queries (in floating-point seconds).

This corresponds to Flight RPC GetFlightInfo calls.

TIMEOUT_UPDATE = 'adbc.flight.sql.rpc.timeout_seconds.update'

Set a timeout on calls that upload or update data (in floating-point seconds).

class adbc_driver_flightsql.DatabaseOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Database options specific to the Flight SQL driver.

AUTHORITY = 'adbc.flight.sql.client_option.authority'

Server name in authentication handshake

AUTHORIZATION_HEADER = 'adbc.flight.sql.authorization_header'

The authorization header to use for requests.

MTLS_CERT_CHAIN = 'adbc.flight.sql.client_option.mtls_cert_chain'

Enable mTLS and use these PEM-encoded certificates.

MTLS_PRIVATE_KEY = 'adbc.flight.sql.client_option.mtls_private_key'

Enable mTLS and use this PEM-encoded private key.

RPC_CALL_HEADER_PREFIX = 'adbc.flight.sql.rpc.call_header.'

Add an arbitrary header to all outgoing requests.

This option should prefix the name of the header to add (i.e. it should be used like f"{DatabaseOptions.RpcCallHeaderPrefix}.x-my-header").

TIMEOUT_FETCH = 'adbc.flight.sql.rpc.timeout_seconds.fetch'

Set a timeout on calls that fetch data (in floating-point seconds).

This corresponds to Flight RPC DoGet calls.

TIMEOUT_QUERY = 'adbc.flight.sql.rpc.timeout_seconds.query'

Set a timeout on calls that execute queries (in floating-point seconds).

This corresponds to Flight RPC GetFlightInfo calls.

TIMEOUT_UPDATE = 'adbc.flight.sql.rpc.timeout_seconds.update'

Set a timeout on calls that upload or update data (in floating-point seconds).

TLS_OVERRIDE_HOSTNAME = 'adbc.flight.sql.client_option.tls_override_hostname'

Override the hostname used for TLS.

TLS_ROOT_CERTS = 'adbc.flight.sql.client_option.tls_root_certs'

Use these PEM-encoded root certificates for TLS.

TLS_SKIP_VERIFY = 'adbc.flight.sql.client_option.tls_skip_verify'

Do not verify the server’s TLS certificate.

WITH_BLOCK = 'adbc.flight.sql.client_option.with_block'

Block and wait for the connection to be established.

Enable cookie middleware. Default is disabled (“false”)

WITH_MAX_MSG_SIZE = 'adbc.flight.sql.client_option.with_max_msg_size'

Set the maximum gRPC message size (in bytes). The default is 16 MiB.

class adbc_driver_flightsql.StatementOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Statement options specific to the Flight SQL driver.

LAST_FLIGHT_INFO = 'adbc.flight.sql.statement.exec.last_flight_info'

The latest FlightInfo value.

Thread-safe. Mostly useful when using incremental execution, where an advanced client may want to inspect the latest FlightInfo from the service, but without waiting for execute_partitions to return. (The service may send an updated FlightInfo with progress/app_metadata values, but execute_partitions will only return if there are new endpoints.)

QUEUE_SIZE = 'adbc.rpc.result_queue_size'

The number of batches to queue per partition. Defaults to 5.

This controls how much we read ahead on result sets.

RPC_CALL_HEADER_PREFIX = 'adbc.flight.sql.rpc.call_header.'

Add an arbitrary header to all outgoing requests.

This option should prefix the name of the header to add (i.e. it should be used like f"{ConnectionOptions.RPC_CALL_HEADER_PREFIX}x-my-header").

Overrides any headers set via the equivalent database or connection options.

SUBSTRAIT_VERSION = 'adbc.flight.sql.substrait.version'

Set the Substrait version passed in the Flight SQL request.

Most servers will not make use of this since the Substrait specification was updated to embed the version in the plan itself after this was originally added to Flight SQL.

TIMEOUT_FETCH = 'adbc.flight.sql.rpc.timeout_seconds.fetch'

Set a timeout on calls that fetch data (in floating-point seconds).

This corresponds to Flight RPC DoGet calls.

TIMEOUT_QUERY = 'adbc.flight.sql.rpc.timeout_seconds.query'

Set a timeout on calls that execute queries (in floating-point seconds).

This corresponds to Flight RPC GetFlightInfo calls.

TIMEOUT_UPDATE = 'adbc.flight.sql.rpc.timeout_seconds.update'

Set a timeout on calls that upload or update data (in floating-point seconds).

adbc_driver_flightsql.connect(uri: str, db_kwargs: Dict[str, str] | None = None) AdbcDatabase

Create a low level ADBC connection to a Flight SQL backend.

Parameters:
uristr

The URI to connect to.

db_kwargsdict, optional

Initial database connection parameters.

DBAPI 2.0 API

DBAPI 2.0-compatible facade for the ADBC Arrow Flight SQL driver.

adbc_driver_flightsql.dbapi.connect(uri: str, db_kwargs: Dict[str, str] | None = None, conn_kwargs: Dict[str, str] | None = None, **kwargs) Connection

Connect to a Flight SQL backend via ADBC.

Parameters:
uristr

The URI to connect to.

db_kwargsdict, optional

Initial database connection parameters.

conn_kwargsdict, optional

Connection-specific parameters. (ADBC differentiates between a ‘database’ object shared between multiple ‘connection’ objects.)