Arrow Flight SQL#

Note

Flight SQL is currently experimental and APIs are subject to change.

Common Types#

group flight-sql-common-types

Typedefs

using SqlInfoResult = arrow::util::Variant<std::string, bool, int64_t, int32_t, std::vector<std::string>, std::unordered_map<int32_t, std::vector<int32_t>>>#

Variant supporting all possible types on SQL info.

using SqlInfoResultMap = std::unordered_map<int32_t, SqlInfoResult>#

Map SQL info identifier to its value.

struct arrow::flight::sql::SqlInfoOptions#
#include <arrow/flight/sql/types.h>

Options to be set in the SqlInfo.

Public Types

enum SqlInfo#

Predefined info values for GetSqlInfo.

Values:

enumerator FLIGHT_SQL_SERVER_NAME#

Retrieves a UTF-8 string with the name of the Flight SQL Server.

enumerator FLIGHT_SQL_SERVER_VERSION#

Retrieves a UTF-8 string with the native version of the Flight SQL Server.

enumerator FLIGHT_SQL_SERVER_ARROW_VERSION#

Retrieves a UTF-8 string with the Arrow format version of the Flight SQL Server.

enumerator FLIGHT_SQL_SERVER_READ_ONLY#

Retrieves a boolean value indicating whether the Flight SQL Server is read only.

Returns:

  • false: if read-write

  • true: if read only

enumerator SQL_DDL_CATALOG#

Retrieves a boolean value indicating whether the Flight SQL Server supports CREATE and DROP of catalogs.

Returns:

  • false: if it doesn’t support CREATE and DROP of catalogs.

  • true: if it supports CREATE and DROP of catalogs.

enumerator SQL_DDL_SCHEMA#

Retrieves a boolean value indicating whether the Flight SQL Server supports CREATE and DROP of schemas.

Returns:

  • false: if it doesn’t support CREATE and DROP of schemas.

  • true: if it supports CREATE and DROP of schemas.

enumerator SQL_DDL_TABLE#

Indicates whether the Flight SQL Server supports CREATE and DROP of tables.

Returns:

  • false: if it doesn’t support CREATE and DROP of tables.

  • true: if it supports CREATE and DROP of tables.

enumerator SQL_IDENTIFIER_CASE#

Retrieves a int32 value representing the enum ordinal for the case sensitivity of catalog, table and schema names.

The possible values are listed in arrow.flight.protocol.sql.SqlSupportedCaseSensitivity.

enumerator SQL_IDENTIFIER_QUOTE_CHAR#

Retrieves a UTF-8 string with the supported character(s) used to surround a delimited identifier.

enumerator SQL_QUOTED_IDENTIFIER_CASE#

Retrieves a int32 value representing the enum ordinal for the case sensitivity of quoted identifiers.

The possible values are listed in arrow.flight.protocol.sql.SqlSupportedCaseSensitivity.

enumerator SQL_ALL_TABLES_ARE_SELECTABLE#

Retrieves a boolean value indicating whether all tables are selectable.

Returns:

  • false: if not all tables are selectable or if none are;

  • true: if all tables are selectable.

enumerator SQL_NULL_ORDERING#

Retrieves the null ordering used by the database as a int32 ordinal value.

Returns a int32 ordinal for the null ordering being used, as described in arrow.flight.protocol.sql.SqlNullOrdering.

enumerator SQL_KEYWORDS#

Retrieves a UTF-8 string list with values of the supported keywords.

enumerator SQL_NUMERIC_FUNCTIONS#

Retrieves a UTF-8 string list with values of the supported numeric functions.

enumerator SQL_STRING_FUNCTIONS#

Retrieves a UTF-8 string list with values of the supported string functions.

enumerator SQL_SYSTEM_FUNCTIONS#

Retrieves a UTF-8 string list with values of the supported system functions.

enumerator SQL_DATETIME_FUNCTIONS#

Retrieves a UTF-8 string list with values of the supported datetime functions.

enumerator SQL_SEARCH_STRING_ESCAPE#

Retrieves the UTF-8 string that can be used to escape wildcard characters.

This is the string that can be used to escape ‘_’ or ‘’ in the catalog search parameters that are a pattern (and therefore use one of the wildcard characters). The ‘_’ character represents any single character; the ‘’ character represents any sequence of zero or more characters.

enumerator SQL_EXTRA_NAME_CHARACTERS#

Retrieves a UTF-8 string with all the “extra” characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _).

enumerator SQL_SUPPORTS_COLUMN_ALIASING#

Retrieves a boolean value indicating whether column aliasing is supported.

If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns as required.

Returns:

  • false: if column aliasing is unsupported;

  • true: if column aliasing is supported.

enumerator SQL_NULL_PLUS_NULL_IS_NULL#

Retrieves a boolean value indicating whether concatenations between null and non-null values being null are supported.

  • Returns:

  • false: if concatenations between null and non-null values being null are unsupported;

  • true: if concatenations between null and non-null values being null are supported.

enumerator SQL_SUPPORTS_CONVERT#

Retrieves a map where the key is the type to convert from and the value is a list with the types to convert to, indicating the supported conversions.

Each key and each item on the list value is a value to a predefined type on SqlSupportsConvert enum. The returned map will be: map<int32, list<int32>>

enumerator SQL_SUPPORTS_TABLE_CORRELATION_NAMES#

Retrieves a boolean value indicating whether, when table correlation names are supported, they are restricted to being different from the names of the tables.

Returns:

  • false: if table correlation names are unsupported;

  • true: if table correlation names are supported.

enumerator SQL_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES#

Retrieves a boolean value indicating whether, when table correlation names are supported, they are restricted to being different from the names of the tables.

Returns:

  • false: if different table correlation names are unsupported;

  • true: if different table correlation names are supported

enumerator SQL_SUPPORTS_EXPRESSIONS_IN_ORDER_BY#

Retrieves a boolean value indicating whether expressions in ORDER BY lists are supported.

Returns:

  • false: if expressions in ORDER BY are unsupported;

  • true: if expressions in ORDER BY are supported;

enumerator SQL_SUPPORTS_ORDER_BY_UNRELATED#

Retrieves a boolean value indicating whether using a column that is not in the SELECT statement in a GROUP BY clause is supported.

Returns:

  • false: if using a column that is not in the SELECT statement in a GROUP BY clause is unsupported;

  • true: if using a column that is not in the SELECT statement in a GROUP BY clause is supported.

enumerator SQL_SUPPORTED_GROUP_BY#

Retrieves the supported GROUP BY commands as an int32 bitmask.

The returned bitmask should be parsed in order to retrieve the supported commands.

  • return 0 (0b0) => [] (GROUP BY is unsupported);

  • return 1 (0b1) => [SQL_GROUP_BY_UNRELATED];

  • return 2 (0b10) => [SQL_GROUP_BY_BEYOND_SELECT];

  • return 3 (0b11) => [SQL_GROUP_BY_UNRELATED, SQL_GROUP_BY_BEYOND_SELECT].

Valid GROUP BY types are described under arrow.flight.protocol.sql.SqlSupportedGroupBy.

enumerator SQL_SUPPORTS_LIKE_ESCAPE_CLAUSE#

Retrieves a boolean value indicating whether specifying a LIKE escape clause is supported.

Returns:

  • false: if specifying a LIKE escape clause is unsupported;

  • true: if specifying a LIKE escape clause is supported.

enumerator SQL_SUPPORTS_NON_NULLABLE_COLUMNS#

Retrieves a boolean value indicating whether columns may be defined as non-nullable.

Returns:

  • false: if columns cannot be defined as non-nullable;

  • true: if columns may be defined as non-nullable.

enumerator SQL_SUPPORTED_GRAMMAR#

Retrieves the supported SQL grammar level as per the ODBC specification.

Returns an int32 bitmask value representing the supported SQL grammar level. The returned bitmask should be parsed in order to retrieve the supported grammar levels.

For instance:

  • return 0 (0b0) => [] (SQL grammar is unsupported);

  • return 1 (0b1) => [SQL_MINIMUM_GRAMMAR];

  • return 2 (0b10) => [SQL_CORE_GRAMMAR];

  • return 3 (0b11) => [SQL_MINIMUM_GRAMMAR, SQL_CORE_GRAMMAR];

  • return 4 (0b100) => [SQL_EXTENDED_GRAMMAR];

  • return 5 (0b101) => [SQL_MINIMUM_GRAMMAR, SQL_EXTENDED_GRAMMAR];

  • return 6 (0b110) => [SQL_CORE_GRAMMAR, SQL_EXTENDED_GRAMMAR];

  • return 7 (0b111) => [SQL_MINIMUM_GRAMMAR, SQL_CORE_GRAMMAR, SQL_EXTENDED_GRAMMAR].

Valid SQL grammar levels are described under arrow.flight.protocol.sql.SupportedSqlGrammar.

enumerator SQL_ANSI92_SUPPORTED_LEVEL#

Retrieves the supported ANSI92 SQL grammar level as per the ODBC specification.

Returns an int32 bitmask value representing the supported ANSI92 SQL grammar level. The returned bitmask should be parsed in order to retrieve the supported grammar levels.

For instance:

  • return 0 (0b0) => [] (ANSI92 SQL grammar is unsupported);

  • return 1 (0b1) => [ANSI92_ENTRY_SQL];

  • return 2 (0b10) => [ANSI92_INTERMEDIATE_SQL];

  • return 3 (0b11) => [ANSI92_ENTRY_SQL, ANSI92_INTERMEDIATE_SQL];

  • return 4 (0b100) => [ANSI92_FULL_SQL];

  • return 5 (0b101) => [ANSI92_ENTRY_SQL, ANSI92_FULL_SQL];

  • return 6 (0b110) => [ANSI92_INTERMEDIATE_SQL, ANSI92_FULL_SQL];

  • return 7 (0b111) => [ANSI92_ENTRY_SQL, ANSI92_INTERMEDIATE_SQL, ANSI92_FULL_SQL].

Valid ANSI92 SQL grammar levels are described under arrow.flight.protocol.sql.SupportedAnsi92SqlGrammarLevel.

enumerator SQL_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY#

Retrieves a boolean value indicating whether the SQL Integrity Enhancement Facility is supported.

Returns:

  • false: if the SQL Integrity Enhancement Facility is supported;

  • true: if the SQL Integrity Enhancement Facility is supported.

enumerator SQL_OUTER_JOINS_SUPPORT_LEVEL#

Retrieves the support level for SQL OUTER JOINs as an int32 ordinal, as described in arrow.flight.protocol.sql.SqlOuterJoinsSupportLevel.

enumerator SQL_SCHEMA_TERM#

Retrieves a UTF-8 string with the preferred term for “schema”.

enumerator SQL_PROCEDURE_TERM#

Retrieves a UTF-8 string with the preferred term for “procedure”.

enumerator SQL_CATALOG_TERM#

Retrieves a UTF-8 string with the preferred term for “catalog”.

enumerator SQL_CATALOG_AT_START#

Retrieves a boolean value indicating whether a catalog appears at the start of a fully qualified table name.

  • false: if a catalog does not appear at the start of a fully qualified table name;

  • true: if a catalog appears at the start of a fully qualified table name.

enumerator SQL_SCHEMAS_SUPPORTED_ACTIONS#

Retrieves the supported actions for a SQL database schema as an int32 bitmask value.

Returns an int32 bitmask value representing the supported actions for a SQL schema. The returned bitmask should be parsed in order to retrieve the supported actions for a SQL schema.

For instance:

  • return 0 (0b0) => [] (no supported actions for SQL schema);

  • return 1 (0b1) => [SQL_ELEMENT_IN_PROCEDURE_CALLS];

  • return 2 (0b10) => [SQL_ELEMENT_IN_INDEX_DEFINITIONS];

  • return 3 (0b11) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_INDEX_DEFINITIONS];

  • return 4 (0b100) => [SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];

  • return 5 (0b101) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];

  • return 6 (0b110) => [SQL_ELEMENT_IN_INDEX_DEFINITIONS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];

  • return 7 (0b111) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_INDEX_DEFINITIONS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS].

Valid actions for a SQL schema described under arrow.flight.protocol.sql.SqlSupportedElementActions.

enumerator SQL_CATALOGS_SUPPORTED_ACTIONS#

Retrieves the supported actions for a SQL catalog as an int32 bitmask value.

Returns an int32 bitmask value representing the supported actions for a SQL catalog. The returned bitmask should be parsed in order to retrieve the supported actions for a SQL catalog.

For instance:

  • return 0 (0b0) => [] (no supported actions for SQL catalog);

  • return 1 (0b1) => [SQL_ELEMENT_IN_PROCEDURE_CALLS];

  • return 2 (0b10) => [SQL_ELEMENT_IN_INDEX_DEFINITIONS];

  • return 3 (0b11) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_INDEX_DEFINITIONS];

  • return 4 (0b100) => [SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];

  • return 5 (0b101) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];

  • return 6 (0b110) => [SQL_ELEMENT_IN_INDEX_DEFINITIONS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];

  • return 7 (0b111) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_INDEX_DEFINITIONS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS].

Valid actions for a SQL catalog are described under arrow.flight.protocol.sql.SqlSupportedElementActions.

enumerator SQL_SUPPORTED_POSITIONED_COMMANDS#

Retrieves the supported SQL positioned commands as an int32 bitmask value.

Returns an int32 bitmask value representing the supported SQL positioned commands. The returned bitmask should be parsed in order to retrieve the supported SQL positioned commands.

For instance:

  • return 0 (0b0) => [] (no supported SQL positioned commands);

  • return 1 (0b1) => [SQL_POSITIONED_DELETE];

  • return 2 (0b10) => [SQL_POSITIONED_UPDATE];

  • return 3 (0b11) => [SQL_POSITIONED_DELETE, SQL_POSITIONED_UPDATE].

Valid SQL positioned commands are described under arrow.flight.protocol.sql.SqlSupportedPositionedCommands.

enumerator SQL_SELECT_FOR_UPDATE_SUPPORTED#

Retrieves a boolean value indicating whether SELECT FOR UPDATE statements are supported.

Returns:

  • false: if SELECT FOR UPDATE statements are unsupported;

  • true: if SELECT FOR UPDATE statements are supported.

enumerator SQL_STORED_PROCEDURES_SUPPORTED#

Retrieves a boolean value indicating whether stored procedure calls that use the stored procedure escape syntax are supported.

Returns:

  • false: if stored procedure calls that use the stored procedure escape syntax are unsupported;

  • true: if stored procedure calls that use the stored procedure escape syntax are supported.

enumerator SQL_SUPPORTED_SUBQUERIES#

Retrieves the types of supported SQL subqueries as an int32 bitmask value.

Returns an int32 bitmask value representing the supported SQL subqueries. The returned bitmask should be parsed in order to retrieve the supported SQL subqueries.

For instance:

  • return 0 (0b0) => [] (no supported SQL subqueries);

  • return 1 (0b1) => [SQL_SUBQUERIES_IN_COMPARISONS];

  • return 2 (0b10) => [SQL_SUBQUERIES_IN_EXISTS];

  • return 3 (0b11) => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS];

  • return 4 (0b100) => [SQL_SUBQUERIES_IN_INS];

  • return 5 (0b101) => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_INS];

  • return 6 (0b110) => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS];

  • return 7 (0b111) => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_INS];

  • return 8 (0b1000) => [SQL_SUBQUERIES_IN_QUANTIFIEDS];

  • return 9 (0b1001) => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_QUANTIFIEDS];

  • return 10 (0b1010) => [SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_QUANTIFIEDS];

  • return 11 (0b1011) => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_QUANTIFIEDS];

  • return 12 (0b1100) => [SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_QUANTIFIEDS];

  • return 13 (0b1101) => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_QUANTIFIEDS];

  • return 14 (0b1110) => [SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_QUANTIFIEDS];

  • return 15 (0b1111) => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_QUANTIFIEDS];

Valid SQL subqueries are described under arrow.flight.protocol.sql.SqlSupportedSubqueries.

enumerator SQL_CORRELATED_SUBQUERIES_SUPPORTED#

Retrieves a boolean value indicating whether correlated subqueries are supported.

Returns:

  • false: if correlated subqueries are unsupported;

  • true: if correlated subqueries are supported.

enumerator SQL_SUPPORTED_UNIONS#

Retrieves the supported SQL UNION features as an int32 bitmask value.

Returns an int32 bitmask value representing the supported SQL UNIONs. The returned bitmask should be parsed in order to retrieve the supported SQL UNIONs.

For instance:

  • return 0 (0b0) => [] (no supported SQL positioned commands);

  • return 1 (0b1) => [SQL_UNION];

  • return 2 (0b10) => [SQL_UNION_ALL];

  • return 3 (0b11) => [SQL_UNION, SQL_UNION_ALL].

Valid SQL union operators are described under arrow.flight.protocol.sql.SqlSupportedUnions.

enumerator SQL_MAX_BINARY_LITERAL_LENGTH#

Retrieves a int64 value representing the maximum number of hex characters allowed in an inline binary literal.

enumerator SQL_MAX_CHAR_LITERAL_LENGTH#

Retrieves a int64 value representing the maximum number of characters allowed for a character literal.

enumerator SQL_MAX_COLUMN_NAME_LENGTH#

Retrieves a int64 value representing the maximum number of characters allowed for a column name.

enumerator SQL_MAX_COLUMNS_IN_GROUP_BY#

Retrieves a int64 value representing the the maximum number of columns allowed in a GROUP BY clause.

enumerator SQL_MAX_COLUMNS_IN_INDEX#

Retrieves a int64 value representing the maximum number of columns allowed in an index.

enumerator SQL_MAX_COLUMNS_IN_ORDER_BY#

Retrieves a int64 value representing the maximum number of columns allowed in an ORDER BY clause.

enumerator SQL_MAX_COLUMNS_IN_SELECT#

Retrieves a int64 value representing the maximum number of columns allowed in a SELECT list.

enumerator SQL_MAX_COLUMNS_IN_TABLE#

Retrieves a int64 value representing the maximum number of columns allowed in a table.

enumerator SQL_MAX_CONNECTIONS#

Retrieves a int64 value representing the maximum number of concurrent connections possible.

enumerator SQL_MAX_CURSOR_NAME_LENGTH#

Retrieves a int64 value the maximum number of characters allowed in a cursor name.

enumerator SQL_MAX_INDEX_LENGTH#

Retrieves a int64 value representing the maximum number of bytes allowed for an index, including all of the parts of the index.

enumerator SQL_SCHEMA_NAME_LENGTH#

Retrieves a int64 value representing the maximum number of characters allowed in a procedure name.

enumerator SQL_MAX_PROCEDURE_NAME_LENGTH#

Retrieves a int64 value representing the maximum number of bytes allowed in a single row.

enumerator SQL_MAX_CATALOG_NAME_LENGTH#

Retrieves a int64 value representing the maximum number of characters allowed in a catalog name.

enumerator SQL_MAX_ROW_SIZE#

Retrieves a int64 value representing the maximum number of bytes allowed in a single row.

enumerator SQL_MAX_ROW_SIZE_INCLUDES_BLOBS#

Retrieves a boolean indicating whether the return value for the JDBC method getMaxRowSize includes the SQL data types LONGVARCHAR and LONGVARBINARY.

Returns:

  • false: if return value for the JDBC method getMaxRowSize does not include the SQL data types LONGVARCHAR and LONGVARBINARY;

  • true: if return value for the JDBC method getMaxRowSize includes the SQL data types LONGVARCHAR and LONGVARBINARY.

enumerator SQL_MAX_STATEMENT_LENGTH#

Retrieves a int32 value representing the maximum number of characters allowed for an SQL statement; a result of 0 (zero) means that there is no limit or the limit is not known.

enumerator SQL_MAX_STATEMENTS#

Retrieves a int32 value representing the maximum number of active statements that can be open at the same time.

enumerator SQL_MAX_TABLE_NAME_LENGTH#

Retrieves a int32 value representing the maximum number of characters allowed in a table name.

enumerator SQL_MAX_TABLES_IN_SELECT#

Retrieves a int32 value representing the maximum number of tables allowed in a SELECT statement.

enumerator SQL_MAX_USERNAME_LENGTH#

Retrieves a int32 value representing the maximum number of characters allowed in a user name.

enumerator SQL_DEFAULT_TRANSACTION_ISOLATION#

Retrieves this database’s default transaction isolation level as described in arrow.flight.protocol.sql.SqlTransactionIsolationLevel.

Returns a int32 ordinal for the SQL transaction isolation level.

enumerator SQL_TRANSACTIONS_SUPPORTED#

Retrieves a boolean value indicating whether transactions are supported.

If not, invoking the method commit is a noop, and the isolation level is arrow.flight.protocol.sql.SqlTransactionIsolationLevel.TRANSACTION_NONE.

Returns:

  • false: if transactions are unsupported;

  • true: if transactions are supported.

enumerator SQL_SUPPORTED_TRANSACTIONS_ISOLATION_LEVELS#

Retrieves the supported transactions isolation levels, if transactions are supported.

Returns an int32 bitmask value representing the supported transactions isolation levels. The returned bitmask should be parsed in order to retrieve the supported transactions isolation levels.

For instance:

  • return 0 (0b0) => [] (no supported SQL transactions isolation levels);

  • return 1 (0b1) => [SQL_TRANSACTION_NONE];

  • return 2 (0b10) => [SQL_TRANSACTION_READ_UNCOMMITTED];

  • return 3 (0b11) => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_READ_UNCOMMITTED];

  • return 4 (0b100) => [SQL_TRANSACTION_REPEATABLE_READ];

  • return 5 (0b101) => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_REPEATABLE_READ];

  • return 6 (0b110) => [SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ];

  • return 7 (0b111) => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ];

  • return 8 (0b1000) => [SQL_TRANSACTION_REPEATABLE_READ];

  • return 9 (0b1001) => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_REPEATABLE_READ];

  • return 10 (0b1010) => [SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ];

  • return 11 (0b1011) => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ];

  • return 12 (0b1100) => [SQL_TRANSACTION_REPEATABLE_READ, SQL_TRANSACTION_REPEATABLE_READ];

  • return 13 (0b1101) => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_REPEATABLE_READ, SQL_TRANSACTION_REPEATABLE_READ];

  • return 14 (0b1110) => [SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ, SQL_TRANSACTION_REPEATABLE_READ];

  • return 15 (0b1111) => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ, SQL_TRANSACTION_REPEATABLE_READ];

  • return 16 (0b10000) => [SQL_TRANSACTION_SERIALIZABLE];

Valid SQL positioned commands are described under arrow.flight.protocol.sql.SqlTransactionIsolationLevel.

enumerator SQL_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT#

Retrieves a boolean value indicating whether a data definition statement within a transaction forces the transaction to commit.

Returns:

  • false: if a data definition statement within a transaction does not force the transaction to commit;

  • true: if a data definition statement within a transaction forces the transaction to commit.

enumerator SQL_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED#

Retrieves a boolean value indicating whether a data definition statement within a transaction is ignored.

Returns:

  • false: if a data definition statement within a transaction is taken into account;

  • true: a data definition statement within a transaction is ignored.

enumerator SQL_SUPPORTED_RESULT_SET_TYPES#

Retrieves an int32 bitmask value representing the supported result set types.

The returned bitmask should be parsed in order to retrieve the supported result set types.

For instance:

  • return 0 (0b0) => [] (no supported result set types);

  • return 1 (0b1) => [SQL_RESULT_SET_TYPE_UNSPECIFIED];

  • return 2 (0b10) => [SQL_RESULT_SET_TYPE_FORWARD_ONLY];

  • return 3 (0b11) => [SQL_RESULT_SET_TYPE_UNSPECIFIED, SQL_RESULT_SET_TYPE_FORWARD_ONLY];

  • return 4 (0b100) => [SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE];

  • return 5 (0b101) => [SQL_RESULT_SET_TYPE_UNSPECIFIED, SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE];

  • return 6 (0b110) => [SQL_RESULT_SET_TYPE_FORWARD_ONLY, SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE];

  • return 7 (0b111) => [SQL_RESULT_SET_TYPE_UNSPECIFIED, SQL_RESULT_SET_TYPE_FORWARD_ONLY, SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE];

  • return 8 (0b1000) => [SQL_RESULT_SET_TYPE_SCROLL_SENSITIVE];

Valid result set types are described under arrow.flight.protocol.sql.SqlSupportedResultSetType.

enumerator SQL_SUPPORTED_CONCURRENCIES_FOR_RESULT_SET_UNSPECIFIED#

Returns an int32 bitmask value representing the concurrency types supported by the server for SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_UNSPECIFIED.

For instance:

  • return 0 (0b0) => [] (no supported concurrency types for this result set type)

  • return 1 (0b1) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED]

  • return 2 (0b10) => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY]

  • return 3 (0b11) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY]

  • return 4 (0b100) => [SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 5 (0b101) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 6 (0b110) => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 7 (0b111) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

Valid result set types are described under arrow.flight.protocol.sql.SqlSupportedResultSetConcurrency.

enumerator SQL_SUPPORTED_CONCURRENCIES_FOR_RESULT_SET_FORWARD_ONLY#

Returns an int32 bitmask value representing the concurrency types supported by the server for SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_FORWARD_ONLY.

For instance:

  • return 0 (0b0) => [] (no supported concurrency types for this result set type)

  • return 1 (0b1) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED]

  • return 2 (0b10) => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY]

  • return 3 (0b11) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY]

  • return 4 (0b100) => [SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 5 (0b101) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 6 (0b110) => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 7 (0b111) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

Valid result set types are described under arrow.flight.protocol.sql.SqlSupportedResultSetConcurrency.

enumerator SQL_SUPPORTED_CONCURRENCIES_FOR_RESULT_SET_SCROLL_SENSITIVE#

Returns an int32 bitmask value representing the concurrency types supported by the server for SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_SCROLL_SENSITIVE.

For instance:

  • return 0 (0b0) => [] (no supported concurrency types for this result set type)

  • return 1 (0b1) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED]

  • return 2 (0b10) => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY]

  • return 3 (0b11) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY]

  • return 4 (0b100) => [SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 5 (0b101) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 6 (0b110) => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 7 (0b111) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

Valid result set types are described under arrow.flight.protocol.sql.SqlSupportedResultSetConcurrency.

enumerator SQL_SUPPORTED_CONCURRENCIES_FOR_RESULT_SET_SCROLL_INSENSITIVE#

Returns an int32 bitmask value representing concurrency types supported by the server for SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE.

For instance:

  • return 0 (0b0) => [] (no supported concurrency types for this result set type)

  • return 1 (0b1) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED]

  • return 2 (0b10) => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY]

  • return 3 (0b11) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY]

  • return 4 (0b100) => [SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 5 (0b101) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 6 (0b110) => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

  • return 7 (0b111) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]

Valid result set types are described under arrow.flight.protocol.sql.SqlSupportedResultSetConcurrency.

enumerator SQL_BATCH_UPDATES_SUPPORTED#

Retrieves a boolean value indicating whether this database supports batch updates.

- false: if this database does not support batch updates;
- true: if this database supports batch updates.

enumerator SQL_SAVEPOINTS_SUPPORTED#

Retrieves a boolean value indicating whether this database supports savepoints.

Returns:
- false: if this database does not support savepoints;
- true: if this database supports savepoints.

enumerator SQL_NAMED_PARAMETERS_SUPPORTED#

Retrieves a boolean value indicating whether named parameters are supported in callable statements.

Returns:

  • false: if named parameters in callable statements are unsupported;

  • true: if named parameters in callable statements are supported.

enumerator SQL_LOCATORS_UPDATE_COPY#

Retrieves a boolean value indicating whether updates made to a LOB are made on a copy or directly to the LOB.

Returns:

  • false: if updates made to a LOB are made directly to the LOB;

  • true: if updates made to a LOB are made on a copy.

enumerator SQL_STORED_FUNCTIONS_USING_CALL_SYNTAX_SUPPORTED#

Retrieves a boolean value indicating whether invoking user-defined or vendor functions using the stored procedure escape syntax is supported.

Returns:

  • false: if invoking user-defined or vendor functions using the stored procedure escape syntax is unsupported;

  • true: if invoking user-defined or vendor functions using the stored procedure escape syntax is supported.

enum SqlSupportedCaseSensitivity#

Indicate whether something (e.g. an identifier) is case-sensitive.

Values:

enumerator SQL_CASE_SENSITIVITY_UNKNOWN#
enumerator SQL_CASE_SENSITIVITY_CASE_INSENSITIVE#
enumerator SQL_CASE_SENSITIVITY_UPPERCASE#
enum SqlNullOrdering#

Indicate how nulls are sorted.

Values:

enumerator SQL_NULLS_SORTED_HIGH#
enumerator SQL_NULLS_SORTED_LOW#
enumerator SQL_NULLS_SORTED_AT_START#
enumerator SQL_NULLS_SORTED_AT_END#
enum SqlSupportsConvert#

Type identifiers used to indicate support for converting between types.

Values:

enumerator SQL_CONVERT_BIGINT#
enumerator SQL_CONVERT_BINARY#
enumerator SQL_CONVERT_BIT#
enumerator SQL_CONVERT_CHAR#
enumerator SQL_CONVERT_DATE#
enumerator SQL_CONVERT_DECIMAL#
enumerator SQL_CONVERT_FLOAT#
enumerator SQL_CONVERT_INTEGER#
enumerator SQL_CONVERT_INTERVAL_DAY_TIME#
enumerator SQL_CONVERT_INTERVAL_YEAR_MONTH#
enumerator SQL_CONVERT_LONGVARBINARY#
enumerator SQL_CONVERT_LONGVARCHAR#
enumerator SQL_CONVERT_NUMERIC#
enumerator SQL_CONVERT_REAL#
enumerator SQL_CONVERT_SMALLINT#
enumerator SQL_CONVERT_TIME#
enumerator SQL_CONVERT_TIMESTAMP#
enumerator SQL_CONVERT_TINYINT#
enumerator SQL_CONVERT_VARBINARY#
enumerator SQL_CONVERT_VARCHAR#
struct arrow::flight::sql::TableRef#
#include <arrow/flight/sql/types.h>

A SQL table reference, optionally containing table’s catalog and db_schema.

Public Members

util::optional<std::string> catalog#

The table’s catalog.

util::optional<std::string> db_schema#

The table’s database schema.

std::string table#

The table name.

Client#

class arrow::flight::sql::FlightSqlClient#

Flight client with Flight SQL semantics.

Wraps a Flight client to provide the Flight SQL RPC calls.

Public Functions

arrow::Result<std::unique_ptr<FlightInfo>> Execute(const FlightCallOptions &options, const std::string &query)#

Execute a query on the server.

Parameters
  • options[in] RPC-layer hints for this call.

  • query[in] The query to be executed in the UTF-8 format.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<int64_t> ExecuteUpdate(const FlightCallOptions &options, const std::string &query)#

Execute an update query on the server.

Parameters
  • options[in] RPC-layer hints for this call.

  • query[in] The query to be executed in the UTF-8 format.

Returns

The quantity of rows affected by the operation.

arrow::Result<std::unique_ptr<FlightInfo>> GetCatalogs(const FlightCallOptions &options)#

Request a list of catalogs.

Parameters

options[in] RPC-layer hints for this call.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetDbSchemas(const FlightCallOptions &options, const std::string *catalog, const std::string *db_schema_filter_pattern)#

Request a list of database schemas.

Parameters
  • options[in] RPC-layer hints for this call.

  • catalog[in] The catalog.

  • db_schema_filter_pattern[in] The schema filter pattern.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightStreamReader>> DoGet(const FlightCallOptions &options, const Ticket &ticket)#

Given a flight ticket and schema, request to be sent the stream.

Returns record batch stream reader

Parameters
  • options[in] Per-RPC options

  • ticket[in] The flight ticket to use

Returns

The returned RecordBatchReader

arrow::Result<std::unique_ptr<FlightInfo>> GetTables(const FlightCallOptions &options, const std::string *catalog, const std::string *db_schema_filter_pattern, const std::string *table_filter_pattern, bool include_schema, const std::vector<std::string> *table_types)#

Request a list of tables.

Parameters
  • options[in] RPC-layer hints for this call.

  • catalog[in] The catalog.

  • db_schema_filter_pattern[in] The schema filter pattern.

  • table_filter_pattern[in] The table filter pattern.

  • include_schema[in] True to include the schema upon return, false to not include the schema.

  • table_types[in] The table types to include.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetPrimaryKeys(const FlightCallOptions &options, const TableRef &table_ref)#

Request the primary keys for a table.

Parameters
  • options[in] RPC-layer hints for this call.

  • table_ref[in] The table reference.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetExportedKeys(const FlightCallOptions &options, const TableRef &table_ref)#

Retrieves a description about the foreign key columns that reference the primary key columns of the given table.

Parameters
  • options[in] RPC-layer hints for this call.

  • table_ref[in] The table reference.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetImportedKeys(const FlightCallOptions &options, const TableRef &table_ref)#

Retrieves the foreign key columns for the given table.

Parameters
  • options[in] RPC-layer hints for this call.

  • table_ref[in] The table reference.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetCrossReference(const FlightCallOptions &options, const TableRef &pk_table_ref, const TableRef &fk_table_ref)#

Retrieves 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).

Parameters
  • options[in] RPC-layer hints for this call.

  • pk_table_ref[in] The table reference that exports the key.

  • fk_table_ref[in] The table reference that imports the key.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetTableTypes(const FlightCallOptions &options)#

Request a list of table types.

Parameters

options[in] RPC-layer hints for this call.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetXdbcTypeInfo(const FlightCallOptions &options)#

Request the information about all the data types supported.

Parameters

options[in] RPC-layer hints for this call.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetXdbcTypeInfo(const FlightCallOptions &options, int data_type)#

Request the information about all the data types supported.

Parameters
  • options[in] RPC-layer hints for this call.

  • data_type[in] The data type to search for as filtering.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::unique_ptr<FlightInfo>> GetSqlInfo(const FlightCallOptions &options, const std::vector<int> &sql_info)#

Request a list of SQL information.

Parameters
  • options[in] RPC-layer hints for this call.

  • sql_info[in] the SQL info required.

Returns

The FlightInfo describing where to access the dataset.

arrow::Result<std::shared_ptr<PreparedStatement>> Prepare(const FlightCallOptions &options, const std::string &query)#

Create a prepared statement object.

Parameters
  • options[in] RPC-layer hints for this call.

  • query[in] The query that will be executed.

Returns

The created prepared statement.

inline virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfo(const FlightCallOptions &options, const FlightDescriptor &descriptor)#

Retrieve the FlightInfo.

Parameters
  • options[in] RPC-layer hints for this call.

  • descriptor[in] The flight descriptor.

Returns

The flight info with the metadata.

Status Close()#

Explicitly shut down and clean up the client.

class arrow::flight::sql::PreparedStatement#

A prepared statement that can be executed.

Public Functions

PreparedStatement(FlightSqlClient *client, std::string handle, std::shared_ptr<Schema> dataset_schema, std::shared_ptr<Schema> parameter_schema, FlightCallOptions options)#

Create a new prepared statement.

However, applications should generally use FlightSqlClient::Prepare.

Parameters
  • client[in] Client object used to make the RPC requests.

  • handle[in] Handle for this prepared statement.

  • dataset_schema[in] Schema of the resulting dataset.

  • parameter_schema[in] Schema of the parameters (if any).

  • options[in] RPC-layer hints for this call.

~PreparedStatement()#

Default destructor for the PreparedStatement class.

The destructor will call the Close method from the class in order, to send a request to close the PreparedStatement. NOTE: It is best to explicitly close the PreparedStatement, otherwise errors can’t be caught.

arrow::Result<std::unique_ptr<FlightInfo>> Execute()#

Executes the prepared statement query on the server.

Returns

A FlightInfo object representing the stream(s) to fetch.

arrow::Result<int64_t> ExecuteUpdate()#

Executes the prepared statement update query on the server.

Returns

The number of rows affected.

std::shared_ptr<Schema> parameter_schema() const#

Retrieve the parameter schema from the query.

Returns

The parameter schema from the query.

std::shared_ptr<Schema> dataset_schema() const#

Retrieve the ResultSet schema from the query.

Returns

The ResultSet schema from the query.

Status SetParameters(std::shared_ptr<RecordBatch> parameter_binding)#

Set a RecordBatch that contains the parameters that will be bind.

Parameters

parameter_binding – The parameters that will be bind.

Returns

Status.

Status Close()#

Close the prepared statement, so that this PreparedStatement can not used anymore and server can free up any resources.

Returns

Status.

bool IsClosed() const#

Check if the prepared statement is closed.

Returns

The state of the prepared statement.

Server#

class arrow::flight::sql::FlightSqlServerBase : public arrow::flight::FlightServerBase#

The base class for Flight SQL servers.

Applications should subclass this class and override the virtual methods declared on this class.

Subclassed by arrow::flight::sql::example::SQLiteFlightSqlServer

Flight SQL methods

Applications should override these methods to implement the Flight SQL endpoints.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoStatement(const ServerCallContext &context, const StatementQuery &command, const FlightDescriptor &descriptor)#

Get a FlightInfo for executing a SQL query.

Parameters
  • context[in] Per-call context.

  • command[in] The StatementQuery object containing the SQL statement.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetStatement(const ServerCallContext &context, const StatementQueryTicket &command)#

Get a FlightDataStream containing the query results.

Parameters
  • context[in] Per-call context.

  • command[in] The StatementQueryTicket containing the statement handle.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoPreparedStatement(const ServerCallContext &context, const PreparedStatementQuery &command, const FlightDescriptor &descriptor)#

Get a FlightInfo for executing an already created prepared statement.

Parameters
  • context[in] Per-call context.

  • command[in] The PreparedStatementQuery object containing the prepared statement handle.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetPreparedStatement(const ServerCallContext &context, const PreparedStatementQuery &command)#

Get a FlightDataStream containing the prepared statement query results.

Parameters
  • context[in] Per-call context.

  • command[in] The PreparedStatementQuery object containing the prepared statement handle.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoCatalogs(const ServerCallContext &context, const FlightDescriptor &descriptor)#

Get a FlightInfo for listing catalogs.

Parameters
  • context[in] Per-call context.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetCatalogs(const ServerCallContext &context)#

Get a FlightDataStream containing the list of catalogs.

Parameters

context[in] Per-call context.

Returns

An interface for sending data back to the client.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoXdbcTypeInfo(const ServerCallContext &context, const GetXdbcTypeInfo &command, const FlightDescriptor &descriptor)#

Gets a FlightInfo for retrieving other information (See TypeInfo).

Parameters
  • context[in] Per-call context.

  • command[in] An optional filter for on the data type.

  • descriptor[in] The descriptor identifying the data stream.

Returns

Status.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetXdbcTypeInfo(const ServerCallContext &context, const GetXdbcTypeInfo &command)#

Gets a FlightDataStream containing information about the data types supported.

Parameters
  • context[in] Per-call context.

  • command[in] The GetXdbcTypeInfo object which may contain filter for the date type to be search for.

Returns

Status.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoSqlInfo(const ServerCallContext &context, const GetSqlInfo &command, const FlightDescriptor &descriptor)#

Get a FlightInfo for retrieving other information (See SqlInfo).

Parameters
  • context[in] Per-call context.

  • command[in] The GetSqlInfo object containing the list of SqlInfo to be returned.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetSqlInfo(const ServerCallContext &context, const GetSqlInfo &command)#

Get a FlightDataStream containing the list of SqlInfo results.

Parameters
  • context[in] Per-call context.

  • command[in] The GetSqlInfo object containing the list of SqlInfo to be returned.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoSchemas(const ServerCallContext &context, const GetDbSchemas &command, const FlightDescriptor &descriptor)#

Get a FlightInfo for listing schemas.

Parameters
  • context[in] Per-call context.

  • command[in] The GetDbSchemas object which may contain filters for catalog and schema name.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetDbSchemas(const ServerCallContext &context, const GetDbSchemas &command)#

Get a FlightDataStream containing the list of schemas.

Parameters
  • context[in] Per-call context.

  • command[in] The GetDbSchemas object which may contain filters for catalog and schema name.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoTables(const ServerCallContext &context, const GetTables &command, const FlightDescriptor &descriptor)#

Get a FlightInfo for listing tables.

Parameters
  • context[in] Per-call context.

  • command[in] The GetTables object which may contain filters for catalog, schema and table names.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetTables(const ServerCallContext &context, const GetTables &command)#

Get a FlightDataStream containing the list of tables.

Parameters
  • context[in] Per-call context.

  • command[in] The GetTables object which may contain filters for catalog, schema and table names.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoTableTypes(const ServerCallContext &context, const FlightDescriptor &descriptor)#

Get a FlightInfo to extract information about the table types.

Parameters
  • context[in] Per-call context.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetTableTypes(const ServerCallContext &context)#

Get a FlightDataStream containing the data related to the table types.

Parameters

context[in] Per-call context.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoPrimaryKeys(const ServerCallContext &context, const GetPrimaryKeys &command, const FlightDescriptor &descriptor)#

Get a FlightInfo to extract information about primary and foreign keys.

Parameters
  • context[in] Per-call context.

  • command[in] The GetPrimaryKeys object with necessary information to execute the request.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetPrimaryKeys(const ServerCallContext &context, const GetPrimaryKeys &command)#

Get a FlightDataStream containing the data related to the primary and foreign keys.

Parameters
  • context[in] Per-call context.

  • command[in] The GetPrimaryKeys object with necessary information to execute the request.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoExportedKeys(const ServerCallContext &context, const GetExportedKeys &command, const FlightDescriptor &descriptor)#

Get a FlightInfo to extract information about foreign and primary keys.

Parameters
  • context[in] Per-call context.

  • command[in] The GetExportedKeys object with necessary information to execute the request.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetExportedKeys(const ServerCallContext &context, const GetExportedKeys &command)#

Get a FlightDataStream containing the data related to the foreign and primary keys.

Parameters
  • context[in] Per-call context.

  • command[in] The GetExportedKeys object with necessary information to execute the request.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoImportedKeys(const ServerCallContext &context, const GetImportedKeys &command, const FlightDescriptor &descriptor)#

Get a FlightInfo to extract information about foreign and primary keys.

Parameters
  • context[in] Per-call context.

  • command[in] The GetImportedKeys object with necessary information to execute the request.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetImportedKeys(const ServerCallContext &context, const GetImportedKeys &command)#

Get a FlightDataStream containing the data related to the foreign and primary keys.

Parameters
  • context[in] Per-call context.

  • command[in] The GetImportedKeys object with necessary information to execute the request.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<std::unique_ptr<FlightInfo>> GetFlightInfoCrossReference(const ServerCallContext &context, const GetCrossReference &command, const FlightDescriptor &descriptor)#

Get a FlightInfo to extract information about foreign and primary keys.

Parameters
  • context[in] Per-call context.

  • command[in] The GetCrossReference object with necessary information to execute the request.

  • descriptor[in] The descriptor identifying the data stream.

Returns

The FlightInfo describing where to access the dataset.

virtual arrow::Result<std::unique_ptr<FlightDataStream>> DoGetCrossReference(const ServerCallContext &context, const GetCrossReference &command)#

Get a FlightDataStream containing the data related to the foreign and primary keys.

Parameters
  • context[in] Per-call context.

  • command[in] The GetCrossReference object with necessary information to execute the request.

Returns

The FlightDataStream containing the results.

virtual arrow::Result<int64_t> DoPutCommandStatementUpdate(const ServerCallContext &context, const StatementUpdate &command)#

Execute an update SQL statement.

Parameters
  • context[in] The call context.

  • command[in] The StatementUpdate object containing the SQL statement.

Returns

The changed record count.

virtual arrow::Result<ActionCreatePreparedStatementResult> CreatePreparedStatement(const ServerCallContext &context, const ActionCreatePreparedStatementRequest &request)#

Create a prepared statement from given SQL statement.

Parameters
Returns

A ActionCreatePreparedStatementResult containing the dataset and parameter schemas and a handle for created statement.

virtual Status ClosePreparedStatement(const ServerCallContext &context, const ActionClosePreparedStatementRequest &request)#

Close a prepared statement.

Parameters
virtual Status DoPutPreparedStatementQuery(const ServerCallContext &context, const PreparedStatementQuery &command, FlightMessageReader *reader, FlightMetadataWriter *writer)#

Bind parameters to given prepared statement.

Parameters
  • context[in] The call context.

  • command[in] The PreparedStatementQuery object containing the prepared statement handle.

  • reader[in] A sequence of uploaded record batches.

  • writer[in] Send metadata back to the client.

virtual arrow::Result<int64_t> DoPutPreparedStatementUpdate(const ServerCallContext &context, const PreparedStatementUpdate &command, FlightMessageReader *reader)#

Execute an update SQL prepared statement.

Parameters
  • context[in] The call context.

  • command[in] The PreparedStatementUpdate object containing the prepared statement handle.

  • reader[in] a sequence of uploaded record batches.

Returns

The changed record count.

Utility methods

void RegisterSqlInfo(int32_t id, const SqlInfoResult &result)#

Register a new SqlInfo result, making it available when calling GetSqlInfo.

Parameters
  • id[in] the SqlInfo identifier.

  • result[in] the result.

Flight RPC handlers

Applications should not override these methods; they implement the Flight SQL protocol.

virtual Status GetFlightInfo(const ServerCallContext &context, const FlightDescriptor &request, std::unique_ptr<FlightInfo> *info) final#

Retrieve the schema and an access plan for the indicated descriptor.

Parameters
  • context[in] The call context.

  • request[in] may be null

  • info[out] the returned flight info provider

Returns

Status

virtual Status DoGet(const ServerCallContext &context, const Ticket &request, std::unique_ptr<FlightDataStream> *stream) final#

Get a stream of IPC payloads to put on the wire.

Parameters
  • context[in] The call context.

  • request[in] an opaque ticket

  • stream[out] the returned stream provider

Returns

Status

virtual Status DoPut(const ServerCallContext &context, std::unique_ptr<FlightMessageReader> reader, std::unique_ptr<FlightMetadataWriter> writer) final#

Process a stream of IPC payloads sent from a client.

Parameters
  • context[in] The call context.

  • reader[in] a sequence of uploaded record batches

  • writer[in] send metadata back to the client

Returns

Status

virtual Status ListActions(const ServerCallContext &context, std::vector<ActionType> *actions) final#

Retrieve the list of available actions.

Parameters
  • context[in] The call context.

  • actions[out] a vector of available action types

Returns

Status

virtual Status DoAction(const ServerCallContext &context, const Action &action, std::unique_ptr<ResultStream> *result) final#

Execute an action, return stream of zero or more results.

Parameters
  • context[in] The call context.

  • action[in] the action to execute, with type and body

  • result[out] the result iterator

Returns

Status

arrow::Result<std::string> arrow::flight::sql::CreateStatementQueryTicket(const std::string &statement_handle)#

A utility function to create a ticket (a opaque binary token that the server uses to identify this query) for a statement query.

Intended for Flight SQL server implementations.

Parameters

statement_handle[in] The statement handle that will originate the ticket.

Returns

The parsed ticket as an string.

class arrow::flight::sql::SqlSchema#

Auxiliary class containing all Schemas used on Flight SQL.

Public Static Functions

static std::shared_ptr<Schema> GetCatalogsSchema()#

Get the Schema used on GetCatalogs response.

Returns

The default schema template.

static std::shared_ptr<Schema> GetDbSchemasSchema()#

Get the Schema used on GetDbSchemas response.

Returns

The default schema template.

static std::shared_ptr<Schema> GetTablesSchema()#

Get the Schema used on GetTables response when included schema flags is set to false.

Returns

The default schema template.

static std::shared_ptr<Schema> GetTablesSchemaWithIncludedSchema()#

Get the Schema used on GetTables response when included schema flags is set to true.

Returns

The default schema template.

static std::shared_ptr<Schema> GetTableTypesSchema()#

Get the Schema used on GetTableTypes response.

Returns

The default schema template.

static std::shared_ptr<Schema> GetPrimaryKeysSchema()#

Get the Schema used on GetPrimaryKeys response when included schema flags is set to true.

Returns

The default schema template.

static std::shared_ptr<Schema> GetExportedKeysSchema()#

Get the Schema used on GetImportedKeys response.

Returns

The default schema template.

static std::shared_ptr<Schema> GetImportedKeysSchema()#

Get the Schema used on GetImportedKeys response.

Returns

The default schema template.

static std::shared_ptr<Schema> GetCrossReferenceSchema()#

Get the Schema used on GetCrossReference response.

Returns

The default schema template.

static std::shared_ptr<Schema> GetXdbcTypeInfoSchema()#

Get the Schema used on GetXdbcTypeInfo response.

Returns

The default schema template.

static std::shared_ptr<Schema> GetSqlInfoSchema()#

Get the Schema used on GetSqlInfo response.

Returns

The default schema template.

group flight-sql-protocol-messages

Simple struct wrappers for various protocol messages, used to avoid exposing Protobuf types in the API.

struct arrow::flight::sql::StatementQuery#
#include <arrow/flight/sql/server.h>

A SQL query.

Public Members

std::string query#

The SQL query.

struct arrow::flight::sql::StatementUpdate#
#include <arrow/flight/sql/server.h>

A SQL update query.

Public Members

std::string query#

The SQL query.

struct arrow::flight::sql::StatementQueryTicket#
#include <arrow/flight/sql/server.h>

A request to execute a query.

Public Members

std::string statement_handle#

The server-generated opaque identifier for the query.

struct arrow::flight::sql::PreparedStatementQuery#
#include <arrow/flight/sql/server.h>

A prepared query statement.

Public Members

std::string prepared_statement_handle#

The server-generated opaque identifier for the statement.

struct arrow::flight::sql::PreparedStatementUpdate#
#include <arrow/flight/sql/server.h>

A prepared update statement.

Public Members

std::string prepared_statement_handle#

The server-generated opaque identifier for the statement.

struct arrow::flight::sql::GetSqlInfo#
#include <arrow/flight/sql/server.h>

A request to fetch server metadata.

Public Members

std::vector<int32_t> info#

A list of metadata IDs to fetch.

struct arrow::flight::sql::GetDbSchemas#
#include <arrow/flight/sql/server.h>

A request to list database schemas.

Public Members

util::optional<std::string> catalog#

An optional database catalog to filter on.

util::optional<std::string> db_schema_filter_pattern#

An optional database schema to filter on.

struct arrow::flight::sql::GetTables#
#include <arrow/flight/sql/server.h>

A request to list database tables.

Public Members

util::optional<std::string> catalog#

An optional database catalog to filter on.

util::optional<std::string> db_schema_filter_pattern#

An optional database schema to filter on.

util::optional<std::string> table_name_filter_pattern#

An optional table name to filter on.

std::vector<std::string> table_types#

A list of table types to filter on.

bool include_schema#

Whether to include the Arrow schema in the response.

struct arrow::flight::sql::GetXdbcTypeInfo#
#include <arrow/flight/sql/server.h>

A request to get SQL data type information.

Public Members

util::optional<int> data_type#

A specific SQL type ID to fetch information about.

struct arrow::flight::sql::GetPrimaryKeys#
#include <arrow/flight/sql/server.h>

A request to list primary keys of a table.

Public Members

TableRef table_ref#

The given table.

struct arrow::flight::sql::GetExportedKeys#
#include <arrow/flight/sql/server.h>

A request to list foreign key columns referencing primary key columns of a table.

Public Members

TableRef table_ref#

The given table.

struct arrow::flight::sql::GetImportedKeys#
#include <arrow/flight/sql/server.h>

A request to list foreign keys of a table.

Public Members

TableRef table_ref#

The given table.

struct arrow::flight::sql::GetCrossReference#
#include <arrow/flight/sql/server.h>

A request to list foreign key columns of a table that reference columns in a given parent table.

Public Members

TableRef pk_table_ref#

The parent table (the one containing referenced columns).

TableRef fk_table_ref#

The foreign table (for which foreign key columns will be listed).

struct arrow::flight::sql::ActionCreatePreparedStatementRequest#
#include <arrow/flight/sql/server.h>

A request to create a new prepared statement.

Public Members

std::string query#

The SQL query.

struct arrow::flight::sql::ActionClosePreparedStatementRequest#
#include <arrow/flight/sql/server.h>

A request to close a prepared statement.

Public Members

std::string prepared_statement_handle#

The server-generated opaque identifier for the statement.

struct arrow::flight::sql::ActionCreatePreparedStatementResult#
#include <arrow/flight/sql/server.h>

The result of creating a new prepared statement.

Public Members

std::shared_ptr<Schema> dataset_schema#

The schema of the query results, if applicable.

std::shared_ptr<Schema> parameter_schema#

The schema of the query parameters, if applicable.

std::string prepared_statement_handle#

The server-generated opaque identifier for the statement.