Module sql

Source
Expand description

Support for execute SQL queries using Apache Arrow Flight SQL.

Flight SQL is built on top of Arrow Flight RPC framework, by defining specific messages, encoded using the protobuf format, sent in theFlightDescriptor::cmd field to FlightService endpoints such asget_flight_info and do_get.

This module contains:

  1. prost generated structs for FlightSQL messages such as CommandStatementQuery
  2. Helpers for encoding and decoding FlightSQL messages: Any and Command
  3. A FlightSqlServiceClient for interacting with FlightSQL servers.
  4. A FlightSqlService to help building FlightSQL servers from FlightService.
  5. Helpers to build responses for FlightSQL metadata APIs: metadata

Modules§

client
A FlightSQL Client FlightSqlServiceClient
gen 🔒
metadata
Builders and function for building responses to FlightSQL metadata / information schema requests.
server
Helper trait FlightSqlService for implementing a FlightService that implements FlightSQL.

Macros§

as_item 🔒
Macro to coerce a token to an item, specifically to build the Commands enum.
prost_message_ext 🔒

Structs§

ActionBeginSavepointRequest
Request message for the “BeginSavepoint” action. Creates a savepoint within a transaction.
ActionBeginSavepointResult
The result of a “BeginSavepoint” action.
ActionBeginTransactionRequest
Request message for the “BeginTransaction” action. Begins a transaction.
ActionBeginTransactionResult
The result of a “BeginTransaction” action.
ActionCancelQueryRequest
Request message for the “CancelQuery” action.
ActionCancelQueryResult
The result of cancelling a query.
ActionClosePreparedStatementRequest
Request message for the “ClosePreparedStatement” action on a Flight SQL enabled backend. Closes server resources associated with the prepared statement handle.
ActionCreatePreparedStatementRequest
Request message for the “CreatePreparedStatement” action on a Flight SQL enabled backend.
ActionCreatePreparedStatementResult
Wrap the result of a “CreatePreparedStatement” or “CreatePreparedSubstraitPlan” action.
ActionCreatePreparedSubstraitPlanRequest
Request message for the “CreatePreparedSubstraitPlan” action on a Flight SQL enabled backend.
ActionEndSavepointRequest
Request message for the “EndSavepoint” action.
ActionEndTransactionRequest
Request message for the “EndTransaction” action.
Any
An implementation of the protobuf Any message type
CommandGetCatalogs
Represents a request to retrieve the list of catalogs on a Flight SQL enabled backend. The definition of a catalog depends on vendor/implementation. It is usually the database itself Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetCrossReference
Represents a request to retrieve a description of the foreign key columns in the given foreign key table that reference the primary key or the columns representing a unique constraint of the parent table (could be the same or a different table) on a Flight SQL enabled backend. Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetDbSchemas
Represents a request to retrieve the list of database schemas on a Flight SQL enabled backend. The definition of a database schema depends on vendor/implementation. It is usually a collection of tables. Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetExportedKeys
Represents a request to retrieve a description of the foreign key columns that reference the given table’s primary key columns (the foreign keys exported by a table) of a table on a Flight SQL enabled backend. Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetImportedKeys
Represents a request to retrieve the foreign keys of a table on a Flight SQL enabled backend. Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetPrimaryKeys
Represents a request to retrieve the primary keys of a table on a Flight SQL enabled backend. Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetSqlInfo
Represents a metadata request. Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetTableTypes
Represents a request to retrieve the list of table types on a Flight SQL enabled backend. The table types depend on vendor/implementation. It is usually used to separate tables from views or system tables. TABLE, VIEW, and SYSTEM TABLE are commonly supported. Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetTables
Represents a request to retrieve the list of tables, and optionally their schemas, on a Flight SQL enabled backend. Used in the command member of FlightDescriptor for the following RPC calls:
CommandGetXdbcTypeInfo
Represents a request to retrieve information about data type supported on a Flight SQL enabled backend. Used in the command member of FlightDescriptor for the following RPC calls:
CommandPreparedStatementQuery
Represents an instance of executing a prepared statement. Used in the command member of FlightDescriptor for the following RPC calls:
CommandPreparedStatementUpdate
Represents a SQL update query. Used in the command member of FlightDescriptor for the RPC call DoPut to cause the server to execute the included prepared statement handle as an update.
CommandStatementIngest
Represents a bulk ingestion request. Used in the command member of FlightDescriptor for the the RPC call DoPut to cause the server load the contents of the stream’s FlightData into the target destination.
CommandStatementQuery
Represents a SQL query. Used in the command member of FlightDescriptor for the following RPC calls:
CommandStatementSubstraitPlan
Represents a Substrait plan. Used in the command member of FlightDescriptor for the following RPC calls:
CommandStatementUpdate
Represents a SQL update query. Used in the command member of FlightDescriptor for the RPC call DoPut to cause the server to execute the included SQL update.
DoPutPreparedStatementResult
An optional response returned when DoPut is called with CommandPreparedStatementQuery.
DoPutUpdateResult
Returned from the RPC call DoPut when a CommandStatementUpdate, CommandPreparedStatementUpdate, or CommandStatementIngest was in the request, containing results from the update.
SubstraitPlan
An embedded message describing a Substrait plan to execute.
TableDefinitionOptions
Options for table definition behavior
TicketStatementQuery

Enums§

Command
Helper to convert to/from protobuf Any message to a specific FlightSQL command message.
EndTransaction
Nullable
Searchable
SqlInfo
Options for CommandGetSqlInfo.
SqlNullOrdering
SqlOuterJoinsSupportLevel
SqlSupportedCaseSensitivity
SqlSupportedElementActions
SqlSupportedGroupBy
SqlSupportedPositionedCommands
SqlSupportedResultSetConcurrency
SqlSupportedResultSetType
SqlSupportedSubqueries
SqlSupportedTransaction
The level of support for Flight SQL transaction RPCs.
SqlSupportedTransactions
SqlSupportedUnions
SqlSupportsConvert
SqlTransactionIsolationLevel
SupportedSqlGrammar
TableExistsOption
The action to take if the target table already exists
TableNotExistOption
The action to take if the target table does not exist
UpdateDeleteRules
XdbcDataType
XdbcDatetimeSubcode

Constants§

ACTION_BEGIN_SAVEPOINT_REQUEST_TYPE_URL 🔒
ACTION_BEGIN_SAVEPOINT_RESULT_TYPE_URL 🔒
ACTION_BEGIN_TRANSACTION_REQUEST_TYPE_URL 🔒
ACTION_BEGIN_TRANSACTION_RESULT_TYPE_URL 🔒
ACTION_CANCEL_QUERY_REQUEST_TYPE_URL 🔒
ACTION_CANCEL_QUERY_RESULT_TYPE_URL 🔒
ACTION_CLOSE_PREPARED_STATEMENT_REQUEST_TYPE_URL 🔒
ACTION_CREATE_PREPARED_STATEMENT_REQUEST_TYPE_URL 🔒
ACTION_CREATE_PREPARED_STATEMENT_RESULT_TYPE_URL 🔒
ACTION_CREATE_PREPARED_SUBSTRAIT_PLAN_REQUEST_TYPE_URL 🔒
ACTION_END_SAVEPOINT_REQUEST_TYPE_URL 🔒
ACTION_END_TRANSACTION_REQUEST_TYPE_URL 🔒
COMMAND_GET_CATALOGS_TYPE_URL 🔒
COMMAND_GET_CROSS_REFERENCE_TYPE_URL 🔒
COMMAND_GET_DB_SCHEMAS_TYPE_URL 🔒
COMMAND_GET_EXPORTED_KEYS_TYPE_URL 🔒
COMMAND_GET_IMPORTED_KEYS_TYPE_URL 🔒
COMMAND_GET_PRIMARY_KEYS_TYPE_URL 🔒
COMMAND_GET_SQL_INFO_TYPE_URL 🔒
COMMAND_GET_TABLES_TYPE_URL 🔒
COMMAND_GET_TABLE_TYPES_TYPE_URL 🔒
COMMAND_GET_XDBC_TYPE_INFO_TYPE_URL 🔒
COMMAND_PREPARED_STATEMENT_QUERY_TYPE_URL 🔒
COMMAND_PREPARED_STATEMENT_UPDATE_TYPE_URL 🔒
COMMAND_STATEMENT_INGEST_TYPE_URL 🔒
COMMAND_STATEMENT_QUERY_TYPE_URL 🔒
COMMAND_STATEMENT_SUBSTRAIT_PLAN_TYPE_URL 🔒
COMMAND_STATEMENT_UPDATE_TYPE_URL 🔒
DO_PUT_PREPARED_STATEMENT_RESULT_TYPE_URL 🔒
DO_PUT_UPDATE_RESULT_TYPE_URL 🔒
TICKET_STATEMENT_QUERY_TYPE_URL 🔒

Traits§

ProstMessageExt
ProstMessageExt are useful utility methods for prost::Message types