Arrow Flight SQL

Arrow Flight SQL is a protocol for interacting with SQL databases using the Arrow in-memory format and the Flight RPC framework.

Generally, a database will implement the RPC methods according to the specification, but does not need to implement a client-side driver. A database client can use the provided Flight SQL client to interact with any database that supports the necessary endpoints. Flight SQL clients wrap the underlying Flight client to provide methods for the new RPC methods described here.

Warning

Flight SQL is experimental and changes to the protocol may still be made.

RPC Methods

Flight SQL reuses the predefined RPC methods in Arrow Flight, and provides various commands that pair those methods with request/response messages defined via Protobuf (see below).

SQL Metadata

Flight SQL provides a variety of commands to fetch catalog metadata about the database server.

All of these commands can be used with the GetFlightInfo and GetSchema RPC methods. The Protobuf request message should be packed into a google.protobuf.Any message, then serialized and packed as the cmd field in a CMD-type FlightDescriptor.

If the command is used with GetFlightInfo, the server will return a FlightInfo response. The client should then use the Ticket(s) in the FlightInfo with the DoGet RPC method to fetch a Arrow data containing the results of the command. In other words, SQL metadata is returned as Arrow data, just like query results themselves.

The Arrow schema returned by GetSchema or DoGet for a particular command is fixed according to the specification.

CommandGetCatalogs

List the catalogs available in the database. The definition varies by vendor.

CommandGetCrossReference

List the foreign key columns in a given table that reference columns in a given parent table.

CommandGetDbSchemas

List the schemas (note: a grouping of tables, not an Arrow schema) available in the database. The definition varies by vendor.

CommandGetExportedKeys

List foreign key columns that reference the primary key columns of a given table.

CommandGetImportedKeys

List foreign keys of a given table.

CommandGetPrimaryKeys

List the primary keys of a given table.

CommandGetSqlInfo

Fetch metadata about the database server and its supported SQL features.

CommandGetTables

List tables in the database.

CommandGetTableTypes

List table types in the database. The list of types varies by vendor.

Query Execution

Flight SQL also provides commands to execute SQL queries and manage prepared statements.

Many of these commands are also used with GetFlightInfo/GetSchema and work identically to the metadata methods above. Some of these commands can be used with the DoPut RPC method, but the command should still be encoded in the request FlightDescriptor in the same way.

Commands beginning with “Action” are instead used with the DoAction RPC method, in which case the command should be packed into a google.protobuf.Any message, then serialized and packed into the body of a Flight Action. Also, the action type should be set to the command name (i.e. for ActionClosePreparedStatementRequest, the type should be ClosePreparedStatement).

ActionClosePreparedStatementRequest

Close a previously created prepared statement.

ActionCreatePreparedStatementRequest

Create a new prepared statement for a SQL query.

CommandPreparedStatementQuery

Execute a previously created prepared statement and get the results.

When used with DoPut: binds parameter values to the prepared statement.

When used with GetFlightInfo: execute the prepared statement. The prepared statement can be reused after fetching results.

CommandPreparedStatementUpdate

Execute a previously created prepared statement that does not return results.

When used with DoPut: execute the query and return the number of affected rows. The prepared statement can be reused afterwards.

CommandStatementQuery

Execute an ad-hoc SQL query.

When used with GetFlightInfo: execute the query (call DoGet to fetch results).

When used with GetSchema: return the schema of the query results.

CommandStatementUpdate

Execute an ad-hoc SQL query that does not return results.

When used with DoPut: execute the query and return the number of affected rows.

Protocol Buffer Definitions

   1/*
   2 * Licensed to the Apache Software Foundation (ASF) under one
   3 * or more contributor license agreements.  See the NOTICE file
   4 * distributed with this work for additional information
   5 * regarding copyright ownership.  The ASF licenses this file
   6 * to you under the Apache License, Version 2.0 (the
   7 * "License"); you may not use this file except in compliance
   8 * with the License.  You may obtain a copy of the License at
   9 * <p>
  10 * http://www.apache.org/licenses/LICENSE-2.0
  11 * <p>
  12 * Unless required by applicable law or agreed to in writing, software
  13 * distributed under the License is distributed on an "AS IS" BASIS,
  14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 * See the License for the specific language governing permissions and
  16 * limitations under the License.
  17 */
  18
  19syntax = "proto3";
  20import "google/protobuf/descriptor.proto";
  21
  22option java_package = "org.apache.arrow.flight.sql.impl";
  23package arrow.flight.protocol.sql;
  24
  25/*
  26 * Represents a metadata request. Used in the command member of FlightDescriptor
  27 * for the following RPC calls:
  28 *  - GetSchema: return the Arrow schema of the query.
  29 *  - GetFlightInfo: execute the metadata request.
  30 *
  31 * The returned Arrow schema will be:
  32 * <
  33 *  info_name: uint32 not null,
  34 *  value: dense_union<
  35 *              string_value: utf8,
  36 *              bool_value: bool,
  37 *              bigint_value: int64,
  38 *              int32_bitmask: int32,
  39 *              string_list: list<string_data: utf8>
  40 *              int32_to_int32_list_map: map<key: int32, value: list<$data$: int32>>
  41 * >
  42 * where there is one row per requested piece of metadata information.
  43 */
  44message CommandGetSqlInfo {
  45  option (experimental) = true;
  46
  47  /*
  48   * Values are modelled after ODBC's SQLGetInfo() function. This information is intended to provide
  49   * Flight SQL clients with basic, SQL syntax and SQL functions related information.
  50   * More information types can be added in future releases.
  51   * E.g. more SQL syntax support types, scalar functions support, type conversion support etc.
  52   *
  53   * Note that the set of metadata may expand.
  54   *
  55   * Initially, Flight SQL will support the following information types:
  56   * - Server Information - Range [0-500)
  57   * - Syntax Information - Range [500-1000)
  58   * Range [0-10,000) is reserved for defaults (see SqlInfo enum for default options). 
  59   * Custom options should start at 10,000.
  60   *
  61   * If omitted, then all metadata will be retrieved.
  62   * Flight SQL Servers may choose to include additional metadata above and beyond the specified set, however they must
  63   * at least return the specified set. IDs ranging from 0 to 10,000 (exclusive) are reserved for future use.
  64   * If additional metadata is included, the metadata IDs should start from 10,000.
  65   */
  66  repeated uint32 info = 1;
  67}
  68
  69// Options for CommandGetSqlInfo.
  70enum SqlInfo {
  71
  72  // Server Information [0-500): Provides basic information about the Flight SQL Server.
  73
  74  // Retrieves a UTF-8 string with the name of the Flight SQL Server.
  75  FLIGHT_SQL_SERVER_NAME = 0;
  76
  77  // Retrieves a UTF-8 string with the native version of the Flight SQL Server.
  78  FLIGHT_SQL_SERVER_VERSION = 1;
  79
  80  // Retrieves a UTF-8 string with the Arrow format version of the Flight SQL Server.
  81  FLIGHT_SQL_SERVER_ARROW_VERSION = 2;
  82
  83  /* 
  84   * Retrieves a boolean value indicating whether the Flight SQL Server is read only.
  85   *
  86   * Returns:
  87   * - false: if read-write
  88   * - true: if read only
  89   */
  90  FLIGHT_SQL_SERVER_READ_ONLY = 3;
  91
  92
  93  // SQL Syntax Information [500-1000): provides information about SQL syntax supported by the Flight SQL Server.
  94
  95  /*
  96   * Retrieves a boolean value indicating whether the Flight SQL Server supports CREATE and DROP of catalogs.
  97   *
  98   * Returns:
  99   * - false: if it doesn't support CREATE and DROP of catalogs.
 100   * - true: if it supports CREATE and DROP of catalogs.
 101   */
 102  SQL_DDL_CATALOG = 500;
 103
 104  /*
 105   * Retrieves a boolean value indicating whether the Flight SQL Server supports CREATE and DROP of schemas.
 106   *
 107   * Returns:
 108   * - false: if it doesn't support CREATE and DROP of schemas.
 109   * - true: if it supports CREATE and DROP of schemas.
 110   */
 111  SQL_DDL_SCHEMA = 501;
 112
 113  /*
 114   * Indicates whether the Flight SQL Server supports CREATE and DROP of tables.
 115   *
 116   * Returns:
 117   * - false: if it doesn't support CREATE and DROP of tables.
 118   * - true: if it supports CREATE and DROP of tables.
 119   */
 120  SQL_DDL_TABLE = 502;
 121
 122  /*
 123   * Retrieves a uint32 value representing the enu uint32 ordinal for the case sensitivity of catalog, table, schema and table names.
 124   *
 125   * The possible values are listed in `arrow.flight.protocol.sql.SqlSupportedCaseSensitivity`.
 126   */
 127  SQL_IDENTIFIER_CASE = 503;
 128
 129  // Retrieves a UTF-8 string with the supported character(s) used to surround a delimited identifier.
 130  SQL_IDENTIFIER_QUOTE_CHAR = 504;
 131
 132  /*
 133   * Retrieves a uint32 value representing the enu uint32 ordinal for the case sensitivity of quoted identifiers.
 134   *
 135   * The possible values are listed in `arrow.flight.protocol.sql.SqlSupportedCaseSensitivity`.
 136   */
 137  SQL_QUOTED_IDENTIFIER_CASE = 505;
 138
 139  /*
 140   * Retrieves a boolean value indicating whether all tables are selectable.
 141   *
 142   * Returns:
 143   * - false: if not all tables are selectable or if none are;
 144   * - true: if all tables are selectable.
 145   */
 146  SQL_ALL_TABLES_ARE_SELECTABLE = 506;
 147
 148  /*
 149   * Retrieves the null ordering.
 150   *
 151   * Returns a uint32 ordinal for the null ordering being used, as described in
 152   * `arrow.flight.protocol.sql.SqlNullOrdering`.
 153   */
 154  SQL_NULL_ORDERING = 507;
 155
 156  // Retrieves a UTF-8 string list with values of the supported keywords.
 157  SQL_KEYWORDS = 508;
 158
 159  // Retrieves a UTF-8 string list with values of the supported numeric functions.
 160  SQL_NUMERIC_FUNCTIONS = 509;
 161
 162  // Retrieves a UTF-8 string list with values of the supported string functions.
 163  SQL_STRING_FUNCTIONS = 510;
 164
 165  // Retrieves a UTF-8 string list with values of the supported system functions.
 166  SQL_SYSTEM_FUNCTIONS = 511;
 167
 168  // Retrieves a UTF-8 string list with values of the supported datetime functions.
 169  SQL_DATETIME_FUNCTIONS = 512;
 170
 171  /*
 172   * Retrieves the UTF-8 string that can be used to escape wildcard characters.
 173   * This is the string that can be used to escape '_' or '%' in the catalog search parameters that are a pattern
 174   * (and therefore use one of the wildcard characters).
 175   * The '_' character represents any single character; the '%' character represents any sequence of zero or more
 176   * characters.
 177   */
 178  SQL_SEARCH_STRING_ESCAPE = 513;
 179
 180  /*
 181   * Retrieves a UTF-8 string with all the "extra" characters that can be used in unquoted identifier names
 182   * (those beyond a-z, A-Z, 0-9 and _).
 183   */
 184  SQL_EXTRA_NAME_CHARACTERS = 514;
 185
 186  /*
 187   * Retrieves a boolean value indicating whether column aliasing is supported.
 188   * If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns
 189   * as required.
 190   *
 191   * Returns:
 192   * - false: if column aliasing is unsupported;
 193   * - true: if column aliasing is supported.
 194   */
 195  SQL_SUPPORTS_COLUMN_ALIASING = 515;
 196
 197  /*
 198   * Retrieves a boolean value indicating whether concatenations between null and non-null values being
 199   * null are supported.
 200   *
 201   * - Returns:
 202   * - false: if concatenations between null and non-null values being null are unsupported;
 203   * - true: if concatenations between null and non-null values being null are supported.
 204   */
 205  SQL_NULL_PLUS_NULL_IS_NULL = 516;
 206
 207  /*
 208   * Retrieves a map where the key is the type to convert from and the value is a list with the types to convert to,
 209   * indicating the supported conversions. Each key and each item on the list value is a value to a predefined type on
 210   * SqlSupportsConvert enum.
 211   * The returned map will be:  map<int32, list<int32>>
 212   */
 213  SQL_SUPPORTS_CONVERT = 517;
 214
 215  /*
 216   * Retrieves a boolean value indicating whether, when table correlation names are supported,
 217   * they are restricted to being different from the names of the tables.
 218   *
 219   * Returns:
 220   * - false: if table correlation names are unsupported;
 221   * - true: if table correlation names are supported.
 222   */
 223  SQL_SUPPORTS_TABLE_CORRELATION_NAMES = 518;
 224
 225  /*
 226   * Retrieves a boolean value indicating whether, when table correlation names are supported,
 227   * they are restricted to being different from the names of the tables.
 228   *
 229   * Returns:
 230   * - false: if different table correlation names are unsupported;
 231   * - true: if different table correlation names are supported
 232   */
 233  SQL_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES = 519;
 234
 235  /*
 236   * Retrieves a boolean value indicating whether expressions in ORDER BY lists are supported.
 237   *
 238   * Returns:
 239   * - false: if expressions in ORDER BY are unsupported;
 240   * - true: if expressions in ORDER BY are supported;
 241   */
 242  SQL_SUPPORTS_EXPRESSIONS_IN_ORDER_BY = 520;
 243
 244  /*
 245   * Retrieves a boolean value indicating whether using a column that is not in the SELECT statement in a GROUP BY
 246   * clause is supported.
 247   *
 248   * Returns:
 249   * - false: if using a column that is not in the SELECT statement in a GROUP BY clause is unsupported;
 250   * - true: if using a column that is not in the SELECT statement in a GROUP BY clause is supported.
 251   */
 252  SQL_SUPPORTS_ORDER_BY_UNRELATED = 521;
 253
 254  /*
 255   * Retrieves the supported GROUP BY commands;
 256   *
 257   * Returns an int32 bitmask value representing the supported commands.
 258   * The returned bitmask should be parsed in order to retrieve the supported commands.
 259   *
 260   * For instance:
 261   * - return 0 (\b0)   => [] (GROUP BY is unsupported);
 262   * - return 1 (\b1)   => [SQL_GROUP_BY_UNRELATED];
 263   * - return 2 (\b10)  => [SQL_GROUP_BY_BEYOND_SELECT];
 264   * - return 3 (\b11)  => [SQL_GROUP_BY_UNRELATED, SQL_GROUP_BY_BEYOND_SELECT].
 265   * Valid GROUP BY types are described under `arrow.flight.protocol.sql.SqlSupportedGroupBy`.
 266   */
 267  SQL_SUPPORTED_GROUP_BY = 522;
 268
 269  /*
 270   * Retrieves a boolean value indicating whether specifying a LIKE escape clause is supported.
 271   *
 272   * Returns:
 273   * - false: if specifying a LIKE escape clause is unsupported;
 274   * - true: if specifying a LIKE escape clause is supported.
 275   */
 276  SQL_SUPPORTS_LIKE_ESCAPE_CLAUSE = 523;
 277
 278  /*
 279   * Retrieves a boolean value indicating whether columns may be defined as non-nullable.
 280   *
 281   * Returns:
 282   * - false: if columns cannot be defined as non-nullable;
 283   * - true: if columns may be defined as non-nullable.
 284   */
 285  SQL_SUPPORTS_NON_NULLABLE_COLUMNS = 524;
 286
 287  /*
 288   * Retrieves the supported SQL grammar level as per the ODBC specification.
 289   *
 290   * Returns an int32 bitmask value representing the supported SQL grammar level.
 291   * The returned bitmask should be parsed in order to retrieve the supported grammar levels.
 292   *
 293   * For instance:
 294   * - return 0 (\b0)   => [] (SQL grammar is unsupported);
 295   * - return 1 (\b1)   => [SQL_MINIMUM_GRAMMAR];
 296   * - return 2 (\b10)  => [SQL_CORE_GRAMMAR];
 297   * - return 3 (\b11)  => [SQL_MINIMUM_GRAMMAR, SQL_CORE_GRAMMAR];
 298   * - return 4 (\b100) => [SQL_EXTENDED_GRAMMAR];
 299   * - return 5 (\b101) => [SQL_MINIMUM_GRAMMAR, SQL_EXTENDED_GRAMMAR];
 300   * - return 6 (\b110) => [SQL_CORE_GRAMMAR, SQL_EXTENDED_GRAMMAR];
 301   * - return 7 (\b111) => [SQL_MINIMUM_GRAMMAR, SQL_CORE_GRAMMAR, SQL_EXTENDED_GRAMMAR].
 302   * Valid SQL grammar levels are described under `arrow.flight.protocol.sql.SupportedSqlGrammar`.
 303   */
 304  SQL_SUPPORTED_GRAMMAR = 525;
 305
 306  /*
 307   * Retrieves the supported ANSI92 SQL grammar level.
 308   *
 309   * Returns an int32 bitmask value representing the supported ANSI92 SQL grammar level.
 310   * The returned bitmask should be parsed in order to retrieve the supported commands.
 311   *
 312   * For instance:
 313   * - return 0 (\b0)   => [] (ANSI92 SQL grammar is unsupported);
 314   * - return 1 (\b1)   => [ANSI92_ENTRY_SQL];
 315   * - return 2 (\b10)  => [ANSI92_INTERMEDIATE_SQL];
 316   * - return 3 (\b11)  => [ANSI92_ENTRY_SQL, ANSI92_INTERMEDIATE_SQL];
 317   * - return 4 (\b100) => [ANSI92_FULL_SQL];
 318   * - return 5 (\b101) => [ANSI92_ENTRY_SQL, ANSI92_FULL_SQL];
 319   * - return 6 (\b110) => [ANSI92_INTERMEDIATE_SQL, ANSI92_FULL_SQL];
 320   * - return 7 (\b111) => [ANSI92_ENTRY_SQL, ANSI92_INTERMEDIATE_SQL, ANSI92_FULL_SQL].
 321   * Valid ANSI92 SQL grammar levels are described under `arrow.flight.protocol.sql.SupportedAnsi92SqlGrammarLevel`.
 322   */
 323  SQL_ANSI92_SUPPORTED_LEVEL = 526;
 324
 325  /*
 326   * Retrieves a boolean value indicating whether the SQL Integrity Enhancement Facility is supported.
 327   *
 328   * Returns:
 329   * - false: if the SQL Integrity Enhancement Facility is supported;
 330   * - true: if the SQL Integrity Enhancement Facility is supported.
 331   */
 332  SQL_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY = 527;
 333
 334  /*
 335   * Retrieves the support level for SQL OUTER JOINs.
 336   *
 337   * Returns a uint3 uint32 ordinal for the SQL ordering being used, as described in
 338   * `arrow.flight.protocol.sql.SqlOuterJoinsSupportLevel`.
 339   */
 340  SQL_OUTER_JOINS_SUPPORT_LEVEL = 528;
 341
 342  // Retrieves a UTF-8 string with the preferred term for "schema".
 343  SQL_SCHEMA_TERM = 529;
 344
 345  // Retrieves a UTF-8 string with the preferred term for "procedure".
 346  SQL_PROCEDURE_TERM = 530;
 347
 348  // Retrieves a UTF-8 string with the preferred term for "catalog".
 349  SQL_CATALOG_TERM = 531;
 350
 351  /*
 352   * Retrieves a boolean value indicating whether a catalog appears at the start of a fully qualified table name.
 353   *
 354   * - false: if a catalog does not appear at the start of a fully qualified table name;
 355   * - true: if a catalog appears at the start of a fully qualified table name.
 356   */
 357  SQL_CATALOG_AT_START = 532;
 358
 359  /*
 360   * Retrieves the supported actions for a SQL schema.
 361   *
 362   * Returns an int32 bitmask value representing the supported actions for a SQL schema.
 363   * The returned bitmask should be parsed in order to retrieve the supported actions for a SQL schema.
 364   *
 365   * For instance:
 366   * - return 0 (\b0)   => [] (no supported actions for SQL schema);
 367   * - return 1 (\b1)   => [SQL_ELEMENT_IN_PROCEDURE_CALLS];
 368   * - return 2 (\b10)  => [SQL_ELEMENT_IN_INDEX_DEFINITIONS];
 369   * - return 3 (\b11)  => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_INDEX_DEFINITIONS];
 370   * - return 4 (\b100) => [SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];
 371   * - return 5 (\b101) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];
 372   * - return 6 (\b110) => [SQL_ELEMENT_IN_INDEX_DEFINITIONS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];
 373   * - return 7 (\b111) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_INDEX_DEFINITIONS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS].
 374   * Valid actions for a SQL schema described under `arrow.flight.protocol.sql.SqlSupportedElementActions`.
 375   */
 376  SQL_SCHEMAS_SUPPORTED_ACTIONS = 533;
 377
 378  /*
 379   * Retrieves the supported actions for a SQL schema.
 380   *
 381   * Returns an int32 bitmask value representing the supported actions for a SQL catalog.
 382   * The returned bitmask should be parsed in order to retrieve the supported actions for a SQL catalog.
 383   *
 384   * For instance:
 385   * - return 0 (\b0)   => [] (no supported actions for SQL catalog);
 386   * - return 1 (\b1)   => [SQL_ELEMENT_IN_PROCEDURE_CALLS];
 387   * - return 2 (\b10)  => [SQL_ELEMENT_IN_INDEX_DEFINITIONS];
 388   * - return 3 (\b11)  => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_INDEX_DEFINITIONS];
 389   * - return 4 (\b100) => [SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];
 390   * - return 5 (\b101) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];
 391   * - return 6 (\b110) => [SQL_ELEMENT_IN_INDEX_DEFINITIONS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS];
 392   * - return 7 (\b111) => [SQL_ELEMENT_IN_PROCEDURE_CALLS, SQL_ELEMENT_IN_INDEX_DEFINITIONS, SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS].
 393   * Valid actions for a SQL catalog are described under `arrow.flight.protocol.sql.SqlSupportedElementActions`.
 394   */
 395  SQL_CATALOGS_SUPPORTED_ACTIONS = 534;
 396
 397  /*
 398   * Retrieves the supported SQL positioned commands.
 399   *
 400   * Returns an int32 bitmask value representing the supported SQL positioned commands.
 401   * The returned bitmask should be parsed in order to retrieve the supported SQL positioned commands.
 402   *
 403   * For instance:
 404   * - return 0 (\b0)   => [] (no supported SQL positioned commands);
 405   * - return 1 (\b1)   => [SQL_POSITIONED_DELETE];
 406   * - return 2 (\b10)  => [SQL_POSITIONED_UPDATE];
 407   * - return 3 (\b11)  => [SQL_POSITIONED_DELETE, SQL_POSITIONED_UPDATE].
 408   * Valid SQL positioned commands are described under `arrow.flight.protocol.sql.SqlSupportedPositionedCommands`.
 409   */
 410  SQL_SUPPORTED_POSITIONED_COMMANDS = 535;
 411
 412  /*
 413   * Retrieves a boolean value indicating whether SELECT FOR UPDATE statements are supported.
 414   *
 415   * Returns:
 416   * - false: if SELECT FOR UPDATE statements are unsupported;
 417   * - true: if SELECT FOR UPDATE statements are supported.
 418   */
 419  SQL_SELECT_FOR_UPDATE_SUPPORTED = 536;
 420
 421  /*
 422   * Retrieves a boolean value indicating whether stored procedure calls that use the stored procedure escape syntax
 423   * are supported.
 424   *
 425   * Returns:
 426   * - false: if stored procedure calls that use the stored procedure escape syntax are unsupported;
 427   * - true: if stored procedure calls that use the stored procedure escape syntax are supported.
 428   */
 429  SQL_STORED_PROCEDURES_SUPPORTED = 537;
 430
 431  /*
 432   * Retrieves the supported SQL subqueries.
 433   *
 434   * Returns an int32 bitmask value representing the supported SQL subqueries.
 435   * The returned bitmask should be parsed in order to retrieve the supported SQL subqueries.
 436   *
 437   * For instance:
 438   * - return 0   (\b0)     => [] (no supported SQL subqueries);
 439   * - return 1   (\b1)     => [SQL_SUBQUERIES_IN_COMPARISONS];
 440   * - return 2   (\b10)    => [SQL_SUBQUERIES_IN_EXISTS];
 441   * - return 3   (\b11)    => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS];
 442   * - return 4   (\b100)   => [SQL_SUBQUERIES_IN_INS];
 443   * - return 5   (\b101)   => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_INS];
 444   * - return 6   (\b110)   => [SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_EXISTS];
 445   * - return 7   (\b111)   => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_INS];
 446   * - return 8   (\b1000)  => [SQL_SUBQUERIES_IN_QUANTIFIEDS];
 447   * - return 9   (\b1001)  => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_QUANTIFIEDS];
 448   * - return 10  (\b1010)  => [SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_QUANTIFIEDS];
 449   * - return 11  (\b1011)  => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_QUANTIFIEDS];
 450   * - return 12  (\b1100)  => [SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_QUANTIFIEDS];
 451   * - return 13  (\b1101)  => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_QUANTIFIEDS];
 452   * - return 14  (\b1110)  => [SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_QUANTIFIEDS];
 453   * - return 15  (\b1111)  => [SQL_SUBQUERIES_IN_COMPARISONS, SQL_SUBQUERIES_IN_EXISTS, SQL_SUBQUERIES_IN_INS, SQL_SUBQUERIES_IN_QUANTIFIEDS];
 454   * - ...
 455   * Valid SQL subqueries are described under `arrow.flight.protocol.sql.SqlSupportedSubqueries`.
 456   */
 457  SQL_SUPPORTED_SUBQUERIES = 538;
 458
 459  /*
 460   * Retrieves a boolean value indicating whether correlated subqueries are supported.
 461   *
 462   * Returns:
 463   * - false: if correlated subqueries are unsupported;
 464   * - true: if correlated subqueries are supported.
 465   */
 466  SQL_CORRELATED_SUBQUERIES_SUPPORTED = 539;
 467
 468  /*
 469   * Retrieves the supported SQL UNIONs.
 470   *
 471   * Returns an int32 bitmask value representing the supported SQL UNIONs.
 472   * The returned bitmask should be parsed in order to retrieve the supported SQL UNIONs.
 473   *
 474   * For instance:
 475   * - return 0 (\b0)   => [] (no supported SQL positioned commands);
 476   * - return 1 (\b1)   => [SQL_UNION];
 477   * - return 2 (\b10)  => [SQL_UNION_ALL];
 478   * - return 3 (\b11)  => [SQL_UNION, SQL_UNION_ALL].
 479   * Valid SQL positioned commands are described under `arrow.flight.protocol.sql.SqlSupportedUnions`.
 480   */
 481  SQL_SUPPORTED_UNIONS = 540;
 482
 483  // Retrieves a uint32 value representing the maximum number of hex characters allowed in an inline binary literal.
 484  SQL_MAX_BINARY_LITERAL_LENGTH = 541;
 485
 486  // Retrieves a uint32 value representing the maximum number of characters allowed for a character literal.
 487  SQL_MAX_CHAR_LITERAL_LENGTH = 542;
 488
 489  // Retrieves a uint32 value representing the maximum number of characters allowed for a column name.
 490  SQL_MAX_COLUMN_NAME_LENGTH = 543;
 491
 492  // Retrieves a uint32 value representing the the maximum number of columns allowed in a GROUP BY clause.
 493  SQL_MAX_COLUMNS_IN_GROUP_BY = 544;
 494
 495  // Retrieves a uint32 value representing the maximum number of columns allowed in an index.
 496  SQL_MAX_COLUMNS_IN_INDEX = 545;
 497
 498  // Retrieves a uint32 value representing the maximum number of columns allowed in an ORDER BY clause.
 499  SQL_MAX_COLUMNS_IN_ORDER_BY = 546;
 500
 501  // Retrieves a uint32 value representing the maximum number of columns allowed in a SELECT list.
 502  SQL_MAX_COLUMNS_IN_SELECT = 547;
 503
 504  // Retrieves a uint32 value representing the maximum number of columns allowed in a table.
 505  SQL_MAX_COLUMNS_IN_TABLE = 548;
 506
 507  // Retrieves a uint32 value representing the maximum number of concurrent connections possible.
 508  SQL_MAX_CONNECTIONS = 549;
 509
 510  // Retrieves a uint32 value the maximum number of characters allowed in a cursor name.
 511  SQL_MAX_CURSOR_NAME_LENGTH = 550;
 512
 513  /*
 514   * Retrieves a uint32 value representing the maximum number of bytes allowed for an index,
 515   * including all of the parts of the index.
 516   */
 517  SQL_MAX_INDEX_LENGTH = 551;
 518
 519  // Retrieves a uint32 value representing the maximum number of characters allowed in a schema name.
 520  SQL_DB_SCHEMA_NAME_LENGTH = 552;
 521
 522  // Retrieves a uint32 value representing the maximum number of characters allowed in a procedure name.
 523  SQL_MAX_PROCEDURE_NAME_LENGTH = 553;
 524
 525  // Retrieves a uint32 value representing the maximum number of characters allowed in a catalog name.
 526  SQL_MAX_CATALOG_NAME_LENGTH = 554;
 527
 528  // Retrieves a uint32 value representing the maximum number of bytes allowed in a single row.
 529  SQL_MAX_ROW_SIZE = 555;
 530
 531  /*
 532   * Retrieves a boolean indicating whether the return value for the JDBC method getMaxRowSize includes the SQL
 533   * data types LONGVARCHAR and LONGVARBINARY.
 534   *
 535   * Returns:
 536   * - false: if return value for the JDBC method getMaxRowSize does
 537   *          not include the SQL data types LONGVARCHAR and LONGVARBINARY;
 538   * - true: if return value for the JDBC method getMaxRowSize includes
 539   *         the SQL data types LONGVARCHAR and LONGVARBINARY.
 540   */
 541  SQL_MAX_ROW_SIZE_INCLUDES_BLOBS = 556;
 542
 543  /*
 544   * Retrieves a uint32 value representing the maximum number of characters allowed for an SQL statement;
 545   * a result of 0 (zero) means that there is no limit or the limit is not known.
 546   */
 547  SQL_MAX_STATEMENT_LENGTH = 557;
 548
 549  // Retrieves a uint32 value representing the maximum number of active statements that can be open at the same time.
 550  SQL_MAX_STATEMENTS = 558;
 551
 552  // Retrieves a uint32 value representing the maximum number of characters allowed in a table name.
 553  SQL_MAX_TABLE_NAME_LENGTH = 559;
 554
 555  // Retrieves a uint32 value representing the maximum number of tables allowed in a SELECT statement.
 556  SQL_MAX_TABLES_IN_SELECT = 560;
 557
 558  // Retrieves a uint32 value representing the maximum number of characters allowed in a user name.
 559  SQL_MAX_USERNAME_LENGTH = 561;
 560
 561  /*
 562   * Retrieves this database's default transaction isolation level as described in
 563   * `arrow.flight.protocol.sql.SqlTransactionIsolationLevel`.
 564   *
 565   * Returns a uint32 ordinal for the SQL transaction isolation level.
 566   */
 567  SQL_DEFAULT_TRANSACTION_ISOLATION = 562;
 568
 569  /*
 570   * Retrieves a boolean value indicating whether transactions are supported. If not, invoking the method commit is a
 571   * noop, and the isolation level is `arrow.flight.protocol.sql.SqlTransactionIsolationLevel.TRANSACTION_NONE`.
 572   *
 573   * Returns:
 574   * - false: if transactions are unsupported;
 575   * - true: if transactions are supported.
 576   */
 577  SQL_TRANSACTIONS_SUPPORTED = 563;
 578
 579  /*
 580   * Retrieves the supported transactions isolation levels.
 581   *
 582   * Returns an int32 bitmask value representing the supported transactions isolation levels.
 583   * The returned bitmask should be parsed in order to retrieve the supported transactions isolation levels.
 584   *
 585   * For instance:
 586   * - return 0   (\b0)     => [] (no supported SQL transactions isolation levels);
 587   * - return 1   (\b1)     => [SQL_TRANSACTION_NONE];
 588   * - return 2   (\b10)    => [SQL_TRANSACTION_READ_UNCOMMITTED];
 589   * - return 3   (\b11)    => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_READ_UNCOMMITTED];
 590   * - return 4   (\b100)   => [SQL_TRANSACTION_REPEATABLE_READ];
 591   * - return 5   (\b101)   => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_REPEATABLE_READ];
 592   * - return 6   (\b110)   => [SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ];
 593   * - return 7   (\b111)   => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ];
 594   * - return 8   (\b1000)  => [SQL_TRANSACTION_REPEATABLE_READ];
 595   * - return 9   (\b1001)  => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_REPEATABLE_READ];
 596   * - return 10  (\b1010)  => [SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ];
 597   * - return 11  (\b1011)  => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ];
 598   * - return 12  (\b1100)  => [SQL_TRANSACTION_REPEATABLE_READ, SQL_TRANSACTION_REPEATABLE_READ];
 599   * - return 13  (\b1101)  => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_REPEATABLE_READ, SQL_TRANSACTION_REPEATABLE_READ];
 600   * - return 14  (\b1110)  => [SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ, SQL_TRANSACTION_REPEATABLE_READ];
 601   * - return 15  (\b1111)  => [SQL_TRANSACTION_NONE, SQL_TRANSACTION_READ_UNCOMMITTED, SQL_TRANSACTION_REPEATABLE_READ, SQL_TRANSACTION_REPEATABLE_READ];
 602   * - return 16  (\b10000) => [SQL_TRANSACTION_SERIALIZABLE];
 603   * - ...
 604   * Valid SQL positioned commands are described under `arrow.flight.protocol.sql.SqlTransactionIsolationLevel`.
 605   */
 606  SQL_SUPPORTED_TRANSACTIONS_ISOLATION_LEVELS = 564;
 607
 608  /*
 609   * Retrieves a boolean value indicating whether a data definition statement within a transaction forces
 610   * the transaction to commit.
 611   *
 612   * Returns:
 613   * - false: if a data definition statement within a transaction does not force the transaction to commit;
 614   * - true: if a data definition statement within a transaction forces the transaction to commit.
 615   */
 616  SQL_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT = 565;
 617
 618  /*
 619   * Retrieves a boolean value indicating whether a data definition statement within a transaction is ignored.
 620   *
 621   * Returns:
 622   * - false: if a data definition statement within a transaction is taken into account;
 623   * - true: a data definition statement within a transaction is ignored.
 624   */
 625  SQL_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED = 566;
 626
 627  /*
 628   * Retrieves an int32 bitmask value representing the supported result set types.
 629   * The returned bitmask should be parsed in order to retrieve the supported result set types.
 630   *
 631   * For instance:
 632   * - return 0   (\b0)     => [] (no supported result set types);
 633   * - return 1   (\b1)     => [SQL_RESULT_SET_TYPE_UNSPECIFIED];
 634   * - return 2   (\b10)    => [SQL_RESULT_SET_TYPE_FORWARD_ONLY];
 635   * - return 3   (\b11)    => [SQL_RESULT_SET_TYPE_UNSPECIFIED, SQL_RESULT_SET_TYPE_FORWARD_ONLY];
 636   * - return 4   (\b100)   => [SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE];
 637   * - return 5   (\b101)   => [SQL_RESULT_SET_TYPE_UNSPECIFIED, SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE];
 638   * - return 6   (\b110)   => [SQL_RESULT_SET_TYPE_FORWARD_ONLY, SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE];
 639   * - return 7   (\b111)   => [SQL_RESULT_SET_TYPE_UNSPECIFIED, SQL_RESULT_SET_TYPE_FORWARD_ONLY, SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE];
 640   * - return 8   (\b1000)  => [SQL_RESULT_SET_TYPE_SCROLL_SENSITIVE];
 641   * - ...
 642   * Valid result set types are described under `arrow.flight.protocol.sql.SqlSupportedResultSetType`.
 643   */
 644  SQL_SUPPORTED_RESULT_SET_TYPES = 567;
 645
 646  /*
 647   * Returns an int32 bitmask value concurrency types supported for
 648   * `arrow.flight.protocol.sql.SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_UNSPECIFIED`.
 649   *
 650   * For instance:
 651   * - return 0 (\b0)   => [] (no supported concurrency types for this result set type)
 652   * - return 1 (\b1)   => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED]
 653   * - return 2 (\b10)  => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY]
 654   * - return 3 (\b11)  => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY]
 655   * - return 4 (\b100) => [SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 656   * - return 5 (\b101) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 657   * - return 6 (\b110)  => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 658   * - return 7 (\b111)  => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 659   * Valid result set types are described under `arrow.flight.protocol.sql.SqlSupportedResultSetConcurrency`.
 660   */
 661  SQL_SUPPORTED_CONCURRENCIES_FOR_RESULT_SET_UNSPECIFIED = 568;
 662
 663  /*
 664   * Returns an int32 bitmask value concurrency types supported for
 665   * `arrow.flight.protocol.sql.SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_FORWARD_ONLY`.
 666   *
 667   * For instance:
 668   * - return 0 (\b0)   => [] (no supported concurrency types for this result set type)
 669   * - return 1 (\b1)   => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED]
 670   * - return 2 (\b10)  => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY]
 671   * - return 3 (\b11)  => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY]
 672   * - return 4 (\b100) => [SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 673   * - return 5 (\b101) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 674   * - return 6 (\b110)  => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 675   * - return 7 (\b111)  => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 676   * Valid result set types are described under `arrow.flight.protocol.sql.SqlSupportedResultSetConcurrency`.
 677   */
 678  SQL_SUPPORTED_CONCURRENCIES_FOR_RESULT_SET_FORWARD_ONLY = 569;
 679
 680  /*
 681   * Returns an int32 bitmask value concurrency types supported for
 682   * `arrow.flight.protocol.sql.SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_SCROLL_SENSITIVE`.
 683   *
 684   * For instance:
 685   * - return 0 (\b0)   => [] (no supported concurrency types for this result set type)
 686   * - return 1 (\b1)   => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED]
 687   * - return 2 (\b10)  => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY]
 688   * - return 3 (\b11)  => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY]
 689   * - return 4 (\b100) => [SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 690   * - return 5 (\b101) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 691   * - return 6 (\b110)  => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 692   * - return 7 (\b111)  => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 693   * Valid result set types are described under `arrow.flight.protocol.sql.SqlSupportedResultSetConcurrency`.
 694   */
 695  SQL_SUPPORTED_CONCURRENCIES_FOR_RESULT_SET_SCROLL_SENSITIVE = 570;
 696
 697  /*
 698   * Returns an int32 bitmask value concurrency types supported for
 699   * `arrow.flight.protocol.sql.SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE`.
 700   *
 701   * For instance:
 702   * - return 0 (\b0)   => [] (no supported concurrency types for this result set type)
 703   * - return 1 (\b1)   => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED]
 704   * - return 2 (\b10)  => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY]
 705   * - return 3 (\b11)  => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY]
 706   * - return 4 (\b100) => [SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 707   * - return 5 (\b101) => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 708   * - return 6 (\b110)  => [SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 709   * - return 7 (\b111)  => [SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED, SQL_RESULT_SET_CONCURRENCY_READ_ONLY, SQL_RESULT_SET_CONCURRENCY_UPDATABLE]
 710   * Valid result set types are described under `arrow.flight.protocol.sql.SqlSupportedResultSetConcurrency`.
 711   */
 712  SQL_SUPPORTED_CONCURRENCIES_FOR_RESULT_SET_SCROLL_INSENSITIVE = 571;
 713
 714  /*
 715   * Retrieves a boolean value indicating whether this database supports batch updates.
 716   *
 717   * - false: if this database does not support batch updates;
 718   * - true: if this database supports batch updates.
 719   */
 720  SQL_BATCH_UPDATES_SUPPORTED = 572;
 721
 722  /*
 723   * Retrieves a boolean value indicating whether this database supports savepoints.
 724   *
 725   * Returns:
 726   * - false: if this database does not support savepoints;
 727   * - true: if this database supports savepoints.
 728   */
 729  SQL_SAVEPOINTS_SUPPORTED = 573;
 730
 731  /*
 732   * Retrieves a boolean value indicating whether named parameters are supported in callable statements.
 733   *
 734   * Returns:
 735   * - false: if named parameters in callable statements are unsupported;
 736   * - true: if named parameters in callable statements are supported.
 737   */
 738  SQL_NAMED_PARAMETERS_SUPPORTED = 574;
 739
 740  /*
 741   * Retrieves a boolean value indicating whether updates made to a LOB are made on a copy or directly to the LOB.
 742   *
 743   * Returns:
 744   * - false: if updates made to a LOB are made directly to the LOB;
 745   * - true: if updates made to a LOB are made on a copy.
 746   */
 747  SQL_LOCATORS_UPDATE_COPY = 575;
 748
 749  /*
 750   * Retrieves a boolean value indicating whether invoking user-defined or vendor functions
 751   * using the stored procedure escape syntax is supported.
 752   *
 753   * Returns:
 754   * - false: if invoking user-defined or vendor functions using the stored procedure escape syntax is unsupported;
 755   * - true: if invoking user-defined or vendor functions using the stored procedure escape syntax is supported.
 756   */
 757  SQL_STORED_FUNCTIONS_USING_CALL_SYNTAX_SUPPORTED = 576;
 758}
 759
 760enum SqlSupportedCaseSensitivity {
 761  SQL_CASE_SENSITIVITY_UNKNOWN = 0;
 762  SQL_CASE_SENSITIVITY_CASE_INSENSITIVE = 1;
 763  SQL_CASE_SENSITIVITY_UPPERCASE = 2;
 764  SQL_CASE_SENSITIVITY_LOWERCASE = 3;
 765}
 766
 767enum SqlNullOrdering {
 768  SQL_NULLS_SORTED_HIGH = 0;
 769  SQL_NULLS_SORTED_LOW = 1;
 770  SQL_NULLS_SORTED_AT_START = 2;
 771  SQL_NULLS_SORTED_AT_END = 3;
 772}
 773
 774enum SupportedSqlGrammar {
 775  SQL_MINIMUM_GRAMMAR = 0;
 776  SQL_CORE_GRAMMAR = 1;
 777  SQL_EXTENDED_GRAMMAR = 2;
 778}
 779
 780enum SupportedAnsi92SqlGrammarLevel {
 781  ANSI92_ENTRY_SQL = 0;
 782  ANSI92_INTERMEDIATE_SQL = 1;
 783  ANSI92_FULL_SQL = 2;
 784}
 785
 786enum SqlOuterJoinsSupportLevel {
 787  SQL_JOINS_UNSUPPORTED = 0;
 788  SQL_LIMITED_OUTER_JOINS = 1;
 789  SQL_FULL_OUTER_JOINS = 2;
 790}
 791
 792enum SqlSupportedGroupBy {
 793  SQL_GROUP_BY_UNRELATED = 0;
 794  SQL_GROUP_BY_BEYOND_SELECT = 1;
 795}
 796
 797enum SqlSupportedElementActions {
 798  SQL_ELEMENT_IN_PROCEDURE_CALLS = 0;
 799  SQL_ELEMENT_IN_INDEX_DEFINITIONS = 1;
 800  SQL_ELEMENT_IN_PRIVILEGE_DEFINITIONS = 2;
 801}
 802
 803enum SqlSupportedPositionedCommands {
 804  SQL_POSITIONED_DELETE = 0;
 805  SQL_POSITIONED_UPDATE = 1;
 806}
 807
 808enum SqlSupportedSubqueries {
 809  SQL_SUBQUERIES_IN_COMPARISONS = 0;
 810  SQL_SUBQUERIES_IN_EXISTS = 1;
 811  SQL_SUBQUERIES_IN_INS = 2;
 812  SQL_SUBQUERIES_IN_QUANTIFIEDS = 3;
 813}
 814
 815enum SqlSupportedUnions {
 816  SQL_UNION = 0;
 817  SQL_UNION_ALL = 1;
 818}
 819
 820enum SqlTransactionIsolationLevel {
 821  SQL_TRANSACTION_NONE = 0;
 822  SQL_TRANSACTION_READ_UNCOMMITTED = 1;
 823  SQL_TRANSACTION_READ_COMMITTED = 2;
 824  SQL_TRANSACTION_REPEATABLE_READ = 3;
 825  SQL_TRANSACTION_SERIALIZABLE = 4;
 826}
 827
 828enum SqlSupportedTransactions {
 829  SQL_TRANSACTION_UNSPECIFIED = 0;
 830  SQL_DATA_DEFINITION_TRANSACTIONS = 1;
 831  SQL_DATA_MANIPULATION_TRANSACTIONS = 2;
 832}
 833
 834enum SqlSupportedResultSetType {
 835  SQL_RESULT_SET_TYPE_UNSPECIFIED = 0;
 836  SQL_RESULT_SET_TYPE_FORWARD_ONLY = 1;
 837  SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE = 2;
 838  SQL_RESULT_SET_TYPE_SCROLL_SENSITIVE = 3;
 839}
 840
 841enum SqlSupportedResultSetConcurrency {
 842  SQL_RESULT_SET_CONCURRENCY_UNSPECIFIED = 0;
 843  SQL_RESULT_SET_CONCURRENCY_READ_ONLY = 1;
 844  SQL_RESULT_SET_CONCURRENCY_UPDATABLE = 2;
 845}
 846
 847enum SqlSupportsConvert {
 848  SQL_CONVERT_BIGINT = 0;
 849  SQL_CONVERT_BINARY = 1;
 850  SQL_CONVERT_BIT = 2;
 851  SQL_CONVERT_CHAR = 3;
 852  SQL_CONVERT_DATE = 4;
 853  SQL_CONVERT_DECIMAL = 5;
 854  SQL_CONVERT_FLOAT = 6;
 855  SQL_CONVERT_INTEGER = 7;
 856  SQL_CONVERT_INTERVAL_DAY_TIME = 8;
 857  SQL_CONVERT_INTERVAL_YEAR_MONTH = 9;
 858  SQL_CONVERT_LONGVARBINARY = 10;
 859  SQL_CONVERT_LONGVARCHAR = 11;
 860  SQL_CONVERT_NUMERIC = 12;
 861  SQL_CONVERT_REAL = 13;
 862  SQL_CONVERT_SMALLINT = 14;
 863  SQL_CONVERT_TIME = 15;
 864  SQL_CONVERT_TIMESTAMP = 16;
 865  SQL_CONVERT_TINYINT = 17;
 866  SQL_CONVERT_VARBINARY = 18;
 867  SQL_CONVERT_VARCHAR = 19;
 868}
 869
 870/*
 871 * Represents a request to retrieve the list of catalogs on a Flight SQL enabled backend.
 872 * The definition of a catalog depends on vendor/implementation. It is usually the database itself
 873 * Used in the command member of FlightDescriptor for the following RPC calls:
 874 *  - GetSchema: return the Arrow schema of the query.
 875 *  - GetFlightInfo: execute the catalog metadata request.
 876 *
 877 * The returned Arrow schema will be:
 878 * <
 879 *  catalog_name: utf8 not null
 880 * >
 881 * The returned data should be ordered by catalog_name.
 882 */
 883message CommandGetCatalogs {
 884  option (experimental) = true;
 885}
 886
 887/*
 888 * Represents a request to retrieve the list of database schemas on a Flight SQL enabled backend.
 889 * The definition of a database schema depends on vendor/implementation. It is usually a collection of tables.
 890 * Used in the command member of FlightDescriptor for the following RPC calls:
 891 *  - GetSchema: return the Arrow schema of the query.
 892 *  - GetFlightInfo: execute the catalog metadata request.
 893 *
 894 * The returned Arrow schema will be:
 895 * <
 896 *  catalog_name: utf8,
 897 *  db_schema_name: utf8 not null
 898 * >
 899 * The returned data should be ordered by catalog_name, then db_schema_name.
 900 */
 901message CommandGetDbSchemas {
 902  option (experimental) = true;
 903
 904  /*
 905   * Specifies the Catalog to search for the tables.
 906   * An empty string retrieves those without a catalog.
 907   * If omitted the catalog name should not be used to narrow the search.
 908   */
 909  optional string catalog = 1;
 910
 911  /*
 912   * Specifies a filter pattern for schemas to search for.
 913   * When no db_schema_filter_pattern is provided, the pattern will not be used to narrow the search.
 914   * In the pattern string, two special characters can be used to denote matching rules:
 915   *    - "%" means to match any substring with 0 or more characters.
 916   *    - "_" means to match any one character.
 917   */
 918  optional string db_schema_filter_pattern = 2;
 919}
 920
 921/*
 922 * Represents a request to retrieve the list of tables, and optionally their schemas, on a Flight SQL enabled backend.
 923 * Used in the command member of FlightDescriptor for the following RPC calls:
 924 *  - GetSchema: return the Arrow schema of the query.
 925 *  - GetFlightInfo: execute the catalog metadata request.
 926 *
 927 * The returned Arrow schema will be:
 928 * <
 929 *  catalog_name: utf8,
 930 *  db_schema_name: utf8,
 931 *  table_name: utf8 not null,
 932 *  table_type: utf8 not null,
 933 *  [optional] table_schema: bytes not null (schema of the table as described in Schema.fbs::Schema,
 934 *                                           it is serialized as an IPC message.)
 935 * >
 936 * The returned data should be ordered by catalog_name, db_schema_name, table_name, then table_type, followed by table_schema if requested.
 937 */
 938message CommandGetTables {
 939  option (experimental) = true;
 940
 941  /*
 942   * Specifies the Catalog to search for the tables.
 943   * An empty string retrieves those without a catalog.
 944   * If omitted the catalog name should not be used to narrow the search.
 945   */
 946  optional string catalog = 1;
 947
 948  /*
 949   * Specifies a filter pattern for schemas to search for.
 950   * When no db_schema_filter_pattern is provided, all schemas matching other filters are searched.
 951   * In the pattern string, two special characters can be used to denote matching rules:
 952   *    - "%" means to match any substring with 0 or more characters.
 953   *    - "_" means to match any one character.
 954   */
 955  optional string db_schema_filter_pattern = 2;
 956
 957  /*
 958   * Specifies a filter pattern for tables to search for.
 959   * When no table_name_filter_pattern is provided, all tables matching other filters are searched.
 960   * In the pattern string, two special characters can be used to denote matching rules:
 961   *    - "%" means to match any substring with 0 or more characters.
 962   *    - "_" means to match any one character.
 963   */
 964  optional string table_name_filter_pattern = 3;
 965
 966  /*
 967   * Specifies a filter of table types which must match.
 968   * The table types depend on vendor/implementation. It is usually used to separate tables from views or system tables.
 969   * TABLE, VIEW, and SYSTEM TABLE are commonly supported.
 970   */
 971  repeated string table_types = 4;
 972
 973  // Specifies if the Arrow schema should be returned for found tables.
 974  bool include_schema = 5;
 975}
 976
 977/*
 978 * Represents a request to retrieve the list of table types on a Flight SQL enabled backend.
 979 * The table types depend on vendor/implementation. It is usually used to separate tables from views or system tables.
 980 * TABLE, VIEW, and SYSTEM TABLE are commonly supported.
 981 * Used in the command member of FlightDescriptor for the following RPC calls:
 982 *  - GetSchema: return the Arrow schema of the query.
 983 *  - GetFlightInfo: execute the catalog metadata request.
 984 *
 985 * The returned Arrow schema will be:
 986 * <
 987 *  table_type: utf8 not null
 988 * >
 989 * The returned data should be ordered by table_type.
 990 */
 991message CommandGetTableTypes {
 992  option (experimental) = true;
 993}
 994
 995/*
 996 * Represents a request to retrieve the primary keys of a table on a Flight SQL enabled backend.
 997 * Used in the command member of FlightDescriptor for the following RPC calls:
 998 *  - GetSchema: return the Arrow schema of the query.
 999 *  - GetFlightInfo: execute the catalog metadata request.
1000 *
1001 * The returned Arrow schema will be:
1002 * <
1003 *  catalog_name: utf8,
1004 *  db_schema_name: utf8,
1005 *  table_name: utf8 not null,
1006 *  column_name: utf8 not null,
1007 *  key_name: utf8,
1008 *  key_sequence: int not null
1009 * >
1010 * The returned data should be ordered by catalog_name, db_schema_name, table_name, key_name, then key_sequence.
1011 */
1012message CommandGetPrimaryKeys {
1013  option (experimental) = true;
1014
1015  /*
1016   * Specifies the catalog to search for the table.
1017   * An empty string retrieves those without a catalog.
1018   * If omitted the catalog name should not be used to narrow the search.
1019   */
1020  optional string catalog = 1;
1021
1022  /*
1023   * Specifies the schema to search for the table.
1024   * An empty string retrieves those without a schema.
1025   * If omitted the schema name should not be used to narrow the search.
1026   */
1027  optional string db_schema = 2;
1028
1029  // Specifies the table to get the primary keys for.
1030  string table = 3;
1031}
1032
1033enum UpdateDeleteRules {
1034  CASCADE = 0;
1035  RESTRICT = 1;
1036  SET_NULL = 2;
1037  NO_ACTION = 3;
1038  SET_DEFAULT = 4;
1039}
1040
1041/*
1042 * Represents a request to retrieve a description of the foreign key columns that reference the given table's
1043 * primary key columns (the foreign keys exported by a table) of a table on a Flight SQL enabled backend.
1044 * Used in the command member of FlightDescriptor for the following RPC calls:
1045 *  - GetSchema: return the Arrow schema of the query.
1046 *  - GetFlightInfo: execute the catalog metadata request.
1047 *
1048 * The returned Arrow schema will be:
1049 * <
1050 *  pk_catalog_name: utf8,
1051 *  pk_db_schema_name: utf8,
1052 *  pk_table_name: utf8 not null,
1053 *  pk_column_name: utf8 not null,
1054 *  fk_catalog_name: utf8,
1055 *  fk_db_schema_name: utf8,
1056 *  fk_table_name: utf8 not null,
1057 *  fk_column_name: utf8 not null,
1058 *  key_sequence: int not null,
1059 *  fk_key_name: utf8,
1060 *  pk_key_name: utf8,
1061 *  update_rule: uint1 not null,
1062 *  delete_rule: uint1 not null
1063 * >
1064 * The returned data should be ordered by fk_catalog_name, fk_db_schema_name, fk_table_name, fk_key_name, then key_sequence.
1065 * update_rule and delete_rule returns a byte that is equivalent to actions declared on UpdateDeleteRules enum.
1066 */
1067message CommandGetExportedKeys {
1068  option (experimental) = true;
1069
1070  /*
1071   * Specifies the catalog to search for the foreign key table.
1072   * An empty string retrieves those without a catalog.
1073   * If omitted the catalog name should not be used to narrow the search.
1074   */
1075  optional string catalog = 1;
1076
1077  /*
1078   * Specifies the schema to search for the foreign key table.
1079   * An empty string retrieves those without a schema.
1080   * If omitted the schema name should not be used to narrow the search.
1081   */
1082  optional string db_schema = 2;
1083
1084  // Specifies the foreign key table to get the foreign keys for.
1085  string table = 3;
1086}
1087
1088/*
1089 * Represents a request to retrieve the foreign keys of a table on a Flight SQL enabled backend.
1090 * Used in the command member of FlightDescriptor for the following RPC calls:
1091 *  - GetSchema: return the Arrow schema of the query.
1092 *  - GetFlightInfo: execute the catalog metadata request.
1093 *
1094 * The returned Arrow schema will be:
1095 * <
1096 *  pk_catalog_name: utf8,
1097 *  pk_db_schema_name: utf8,
1098 *  pk_table_name: utf8 not null,
1099 *  pk_column_name: utf8 not null,
1100 *  fk_catalog_name: utf8,
1101 *  fk_db_schema_name: utf8,
1102 *  fk_table_name: utf8 not null,
1103 *  fk_column_name: utf8 not null,
1104 *  key_sequence: int not null,
1105 *  fk_key_name: utf8,
1106 *  pk_key_name: utf8,
1107 *  update_rule: uint1 not null,
1108 *  delete_rule: uint1 not null
1109 * >
1110 * The returned data should be ordered by pk_catalog_name, pk_db_schema_name, pk_table_name, pk_key_name, then key_sequence.
1111 * update_rule and delete_rule returns a byte that is equivalent to actions:
1112 *    - 0 = CASCADE
1113 *    - 1 = RESTRICT
1114 *    - 2 = SET NULL
1115 *    - 3 = NO ACTION
1116 *    - 4 = SET DEFAULT
1117 */
1118message CommandGetImportedKeys {
1119  option (experimental) = true;
1120
1121  /*
1122   * Specifies the catalog to search for the primary key table.
1123   * An empty string retrieves those without a catalog.
1124   * If omitted the catalog name should not be used to narrow the search.
1125   */
1126  optional string catalog = 1;
1127
1128  /*
1129   * Specifies the schema to search for the primary key table.
1130   * An empty string retrieves those without a schema.
1131   * If omitted the schema name should not be used to narrow the search.
1132   */
1133  optional string db_schema = 2;
1134
1135  // Specifies the primary key table to get the foreign keys for.
1136  string table = 3;
1137}
1138
1139/*
1140 * Represents a request to retrieve a description of the foreign key columns in the given foreign key table that
1141 * reference the primary key or the columns representing a unique constraint of the parent table (could be the same
1142 * or a different table) on a Flight SQL enabled backend.
1143 * Used in the command member of FlightDescriptor for the following RPC calls:
1144 *  - GetSchema: return the Arrow schema of the query.
1145 *  - GetFlightInfo: execute the catalog metadata request.
1146 *
1147 * The returned Arrow schema will be:
1148 * <
1149 *  pk_catalog_name: utf8,
1150 *  pk_db_schema_name: utf8,
1151 *  pk_table_name: utf8 not null,
1152 *  pk_column_name: utf8 not null,
1153 *  fk_catalog_name: utf8,
1154 *  fk_db_schema_name: utf8,
1155 *  fk_table_name: utf8 not null,
1156 *  fk_column_name: utf8 not null,
1157 *  key_sequence: int not null,
1158 *  fk_key_name: utf8,
1159 *  pk_key_name: utf8,
1160 *  update_rule: uint1 not null,
1161 *  delete_rule: uint1 not null
1162 * >
1163 * The returned data should be ordered by pk_catalog_name, pk_db_schema_name, pk_table_name, pk_key_name, then key_sequence.
1164 * update_rule and delete_rule returns a byte that is equivalent to actions:
1165 *    - 0 = CASCADE
1166 *    - 1 = RESTRICT
1167 *    - 2 = SET NULL
1168 *    - 3 = NO ACTION
1169 *    - 4 = SET DEFAULT
1170 */
1171message CommandGetCrossReference {
1172  option (experimental) = true;
1173
1174  /**
1175   * The catalog name where the parent table is.
1176   * An empty string retrieves those without a catalog.
1177   * If omitted the catalog name should not be used to narrow the search.
1178   */
1179  optional string pk_catalog = 1;
1180
1181  /**
1182   * The Schema name where the parent table is.
1183   * An empty string retrieves those without a schema.
1184   * If omitted the schema name should not be used to narrow the search.
1185   */
1186  optional string pk_db_schema = 2;
1187
1188  /**
1189   * The parent table name. It cannot be null.
1190   */
1191  string pk_table = 3;
1192
1193  /**
1194   * The catalog name where the foreign table is.
1195   * An empty string retrieves those without a catalog.
1196   * If omitted the catalog name should not be used to narrow the search.
1197   */
1198  optional string fk_catalog = 4;
1199
1200  /**
1201   * The schema name where the foreign table is.
1202   * An empty string retrieves those without a schema.
1203   * If omitted the schema name should not be used to narrow the search.
1204   */
1205  optional string fk_db_schema = 5;
1206
1207  /**
1208   * The foreign table name. It cannot be null.
1209   */
1210  string fk_table = 6;
1211}
1212
1213// SQL Execution Action Messages
1214
1215/*
1216 * Request message for the "CreatePreparedStatement" action on a Flight SQL enabled backend.
1217 */
1218message ActionCreatePreparedStatementRequest {
1219  option (experimental) = true;
1220
1221  // The valid SQL string to create a prepared statement for.
1222  string query = 1;
1223}
1224
1225/*
1226 * Wrap the result of a "GetPreparedStatement" action.
1227 *
1228 * The resultant PreparedStatement can be closed either:
1229 * - Manually, through the "ClosePreparedStatement" action;
1230 * - Automatically, by a server timeout.
1231 */
1232message ActionCreatePreparedStatementResult {
1233  option (experimental) = true;
1234
1235  // Opaque handle for the prepared statement on the server.
1236  bytes prepared_statement_handle = 1;
1237
1238  // If a result set generating query was provided, dataset_schema contains the 
1239  // schema of the dataset as described in Schema.fbs::Schema, it is serialized as an IPC message.
1240  bytes dataset_schema = 2;
1241
1242  // If the query provided contained parameters, parameter_schema contains the 
1243  // schema of the expected parameters as described in Schema.fbs::Schema, it is serialized as an IPC message.
1244  bytes parameter_schema = 3;
1245}
1246
1247/*
1248 * Request message for the "ClosePreparedStatement" action on a Flight SQL enabled backend.
1249 * Closes server resources associated with the prepared statement handle.
1250 */
1251message ActionClosePreparedStatementRequest {
1252  option (experimental) = true;
1253
1254  // Opaque handle for the prepared statement on the server.
1255  bytes prepared_statement_handle = 1;
1256}
1257
1258
1259// SQL Execution Messages.
1260
1261/*
1262 * Represents a SQL query. Used in the command member of FlightDescriptor
1263 * for the following RPC calls:
1264 *  - GetSchema: return the Arrow schema of the query.
1265 *  - GetFlightInfo: execute the query.
1266 */
1267message CommandStatementQuery {
1268  option (experimental) = true;
1269
1270  // The SQL syntax.
1271  string query = 1;
1272}
1273
1274/**
1275 * Represents a ticket resulting from GetFlightInfo with a CommandStatementQuery.
1276 * This should be used only once and treated as an opaque value, that is, clients should not attempt to parse this.
1277 */
1278message TicketStatementQuery {
1279  option (experimental) = true;
1280
1281  // Unique identifier for the instance of the statement to execute.
1282  bytes statement_handle = 1;
1283}
1284
1285/*
1286 * Represents an instance of executing a prepared statement. Used in the command member of FlightDescriptor for
1287 * the following RPC calls:
1288 *  - DoPut: bind parameter values. All of the bound parameter sets will be executed as a single atomic execution.
1289 *  - GetFlightInfo: execute the prepared statement instance.
1290 */
1291message CommandPreparedStatementQuery {
1292  option (experimental) = true;
1293
1294  // Opaque handle for the prepared statement on the server.
1295  bytes prepared_statement_handle = 1;
1296}
1297
1298/*
1299 * Represents a SQL update query. Used in the command member of FlightDescriptor
1300 * for the the RPC call DoPut to cause the server to execute the included SQL update.
1301 */
1302message CommandStatementUpdate {
1303  option (experimental) = true;
1304
1305  // The SQL syntax.
1306  string query = 1;
1307}
1308
1309/*
1310 * Represents a SQL update query. Used in the command member of FlightDescriptor
1311 * for the the RPC call DoPut to cause the server to execute the included 
1312 * prepared statement handle as an update.
1313 */
1314message CommandPreparedStatementUpdate {
1315  option (experimental) = true;
1316
1317  // Opaque handle for the prepared statement on the server.
1318  bytes prepared_statement_handle = 1;
1319}
1320
1321/*
1322 * Returned from the RPC call DoPut when a CommandStatementUpdate
1323 * CommandPreparedStatementUpdate was in the request, containing
1324 * results from the update. 
1325 */
1326message DoPutUpdateResult {
1327  option (experimental) = true;
1328
1329  // The number of records updated. A return value of -1 represents 
1330  // an unknown updated record count.
1331  int64 record_count = 1;
1332}
1333
1334extend google.protobuf.MessageOptions {
1335  bool experimental = 1000;
1336}