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.

Sequence Diagrams#

../_images/CommandGetTables.mmd.svg

Listing available tables.#

../_images/CommandStatementQuery.mmd.svg

Executing an ad-hoc query.#

../_images/CommandPreparedStatementQuery.mmd.svg

Creating a prepared statement, then executing it.#

External Resources#

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 int32 ordinal representing 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 int32 describing 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 int32 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 int32 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 int64 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 int64 value representing the maximum number of characters allowed for a character literal.
 487  SQL_MAX_CHAR_LITERAL_LENGTH = 542;
 488
 489  // Retrieves a int64 value representing the maximum number of characters allowed for a column name.
 490  SQL_MAX_COLUMN_NAME_LENGTH = 543;
 491
 492  // Retrieves a int64 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 int64 value representing the maximum number of columns allowed in an index.
 496  SQL_MAX_COLUMNS_IN_INDEX = 545;
 497
 498  // Retrieves a int64 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 int64 value representing the maximum number of columns allowed in a SELECT list.
 502  SQL_MAX_COLUMNS_IN_SELECT = 547;
 503
 504  // Retrieves a int64 value representing the maximum number of columns allowed in a table.
 505  SQL_MAX_COLUMNS_IN_TABLE = 548;
 506
 507  // Retrieves a int64 value representing the maximum number of concurrent connections possible.
 508  SQL_MAX_CONNECTIONS = 549;
 509
 510  // Retrieves a int64 value the maximum number of characters allowed in a cursor name.
 511  SQL_MAX_CURSOR_NAME_LENGTH = 550;
 512
 513  /*
 514   * Retrieves a int64 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 int64 value representing the maximum number of characters allowed in a schema name.
 520  SQL_DB_SCHEMA_NAME_LENGTH = 552;
 521
 522  // Retrieves a int64 value representing the maximum number of characters allowed in a procedure name.
 523  SQL_MAX_PROCEDURE_NAME_LENGTH = 553;
 524
 525  // Retrieves a int64 value representing the maximum number of characters allowed in a catalog name.
 526  SQL_MAX_CATALOG_NAME_LENGTH = 554;
 527
 528  // Retrieves a int64 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 int64 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 int64 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 int64 value representing the maximum number of characters allowed in a table name.
 553  SQL_MAX_TABLE_NAME_LENGTH = 559;
 554
 555  // Retrieves a int64 value representing the maximum number of tables allowed in a SELECT statement.
 556  SQL_MAX_TABLES_IN_SELECT = 560;
 557
 558  // Retrieves a int64 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 int32 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 * The JDBC/ODBC-defined type of any object.
 872 * All the values here are the sames as in the JDBC and ODBC specs.
 873 */
 874enum XdbcDataType {
 875  XDBC_UNKNOWN_TYPE = 0;
 876  XDBC_CHAR = 1;
 877  XDBC_NUMERIC = 2;
 878  XDBC_DECIMAL = 3;
 879  XDBC_INTEGER = 4;
 880  XDBC_SMALLINT = 5;
 881  XDBC_FLOAT = 6;
 882  XDBC_REAL = 7;
 883  XDBC_DOUBLE = 8;
 884  XDBC_DATETIME = 9;
 885  XDBC_INTERVAL = 10;
 886  XDBC_VARCHAR = 12;
 887  XDBC_DATE = 91;
 888  XDBC_TIME = 92;
 889  XDBC_TIMESTAMP = 93;
 890  XDBC_LONGVARCHAR = -1;
 891  XDBC_BINARY = -2;
 892  XDBC_VARBINARY = -3;
 893  XDBC_LONGVARBINARY = -4;
 894  XDBC_BIGINT = -5;
 895  XDBC_TINYINT = -6;
 896  XDBC_BIT = -7;
 897  XDBC_WCHAR = -8;
 898  XDBC_WVARCHAR = -9;
 899}
 900
 901/**
 902 * Detailed subtype information for XDBC_TYPE_DATETIME and XDBC_TYPE_INTERVAL.
 903 */
 904enum XdbcDatetimeSubcode {
 905  option allow_alias = true;
 906  XDBC_SUBCODE_UNKNOWN = 0;
 907  XDBC_SUBCODE_YEAR = 1;
 908  XDBC_SUBCODE_DATE = 1;
 909  XDBC_SUBCODE_TIME = 2;
 910  XDBC_SUBCODE_MONTH = 2;
 911  XDBC_SUBCODE_TIMESTAMP = 3;
 912  XDBC_SUBCODE_DAY = 3;
 913  XDBC_SUBCODE_TIME_WITH_TIMEZONE = 4;
 914  XDBC_SUBCODE_HOUR = 4;
 915  XDBC_SUBCODE_TIMESTAMP_WITH_TIMEZONE = 5;
 916  XDBC_SUBCODE_MINUTE = 5;
 917  XDBC_SUBCODE_SECOND = 6;
 918  XDBC_SUBCODE_YEAR_TO_MONTH = 7;
 919  XDBC_SUBCODE_DAY_TO_HOUR = 8;
 920  XDBC_SUBCODE_DAY_TO_MINUTE = 9;
 921  XDBC_SUBCODE_DAY_TO_SECOND = 10;
 922  XDBC_SUBCODE_HOUR_TO_MINUTE = 11;
 923  XDBC_SUBCODE_HOUR_TO_SECOND = 12;
 924  XDBC_SUBCODE_MINUTE_TO_SECOND = 13;
 925  XDBC_SUBCODE_INTERVAL_YEAR = 101;
 926  XDBC_SUBCODE_INTERVAL_MONTH = 102;
 927  XDBC_SUBCODE_INTERVAL_DAY = 103;
 928  XDBC_SUBCODE_INTERVAL_HOUR = 104;
 929  XDBC_SUBCODE_INTERVAL_MINUTE = 105;
 930  XDBC_SUBCODE_INTERVAL_SECOND = 106;
 931  XDBC_SUBCODE_INTERVAL_YEAR_TO_MONTH = 107;
 932  XDBC_SUBCODE_INTERVAL_DAY_TO_HOUR = 108;
 933  XDBC_SUBCODE_INTERVAL_DAY_TO_MINUTE = 109;
 934  XDBC_SUBCODE_INTERVAL_DAY_TO_SECOND = 110;
 935  XDBC_SUBCODE_INTERVAL_HOUR_TO_MINUTE = 111;
 936  XDBC_SUBCODE_INTERVAL_HOUR_TO_SECOND = 112;
 937  XDBC_SUBCODE_INTERVAL_MINUTE_TO_SECOND = 113;
 938}
 939
 940enum Nullable {
 941  /**
 942   * Indicates that the fields does not allow the use of null values.
 943   */
 944  NULLABILITY_NO_NULLS = 0;
 945
 946  /**
 947   * Indicates that the fields allow the use of null values.
 948   */
 949  NULLABILITY_NULLABLE = 1;
 950
 951  /**
 952   * Indicates that nullability of the fields can not be determined.
 953   */
 954  NULLABILITY_UNKNOWN = 2;
 955}
 956
 957enum Searchable {
 958  /**
 959   * Indicates that column can not be used in a WHERE clause.
 960   */
 961  SEARCHABLE_NONE = 0;
 962
 963  /**
 964   * Indicates that the column can be used in a WHERE clause if it is using a
 965   * LIKE operator.
 966   */
 967  SEARCHABLE_CHAR = 1;
 968
 969  /**
 970   * Indicates that the column can be used In a WHERE clause with any
 971   * operator other than LIKE.
 972   *
 973   * - Allowed operators: comparison, quantified comparison, BETWEEN,
 974   *                      DISTINCT, IN, MATCH, and UNIQUE.
 975   */
 976  SEARCHABLE_BASIC = 2;
 977
 978  /**
 979   * Indicates that the column can be used in a WHERE clause using any operator.
 980   */
 981  SEARCHABLE_FULL = 3;
 982}
 983
 984/*
 985 * Represents a request to retrieve information about data type supported on a Flight SQL enabled backend.
 986 * Used in the command member of FlightDescriptor for the following RPC calls:
 987 *  - GetSchema: return the schema of the query.
 988 *  - GetFlightInfo: execute the catalog metadata request.
 989 *
 990 * The returned schema will be:
 991 * <
 992 *   type_name: utf8 not null (The name of the data type, for example: VARCHAR, INTEGER, etc),
 993 *   data_type: int not null (The SQL data type),
 994 *   column_size: int (The maximum size supported by that column.
 995 *                     In case of exact numeric types, this represents the maximum precision.
 996 *                     In case of string types, this represents the character length.
 997 *                     In case of datetime data types, this represents the length in characters of the string representation.
 998 *                     NULL is returned for data types where column size is not applicable.),
 999 *   literal_prefix: utf8 (Character or characters used to prefix a literal, NULL is returned for
1000 *                         data types where a literal prefix is not applicable.),
1001 *   literal_suffix: utf8 (Character or characters used to terminate a literal,
1002 *                         NULL is returned for data types where a literal suffix is not applicable.),
1003 *   create_params: list<utf8 not null>
1004 *                        (A list of keywords corresponding to which parameters can be used when creating
1005 *                         a column for that specific type.
1006 *                         NULL is returned if there are no parameters for the data type definition.),
1007 *   nullable: int not null (Shows if the data type accepts a NULL value. The possible values can be seen in the
1008 *                           Nullable enum.),
1009 *   case_sensitive: bool not null (Shows if a character data type is case-sensitive in collations and comparisons),
1010 *   searchable: int not null (Shows how the data type is used in a WHERE clause. The possible values can be seen in the
1011 *                             Searchable enum.),
1012 *   unsigned_attribute: bool (Shows if the data type is unsigned. NULL is returned if the attribute is
1013 *                             not applicable to the data type or the data type is not numeric.),
1014 *   fixed_prec_scale: bool not null (Shows if the data type has predefined fixed precision and scale.),
1015 *   auto_increment: bool (Shows if the data type is auto incremental. NULL is returned if the attribute
1016 *                         is not applicable to the data type or the data type is not numeric.),
1017 *   local_type_name: utf8 (Localized version of the data source-dependent name of the data type. NULL
1018 *                          is returned if a localized name is not supported by the data source),
1019 *   minimum_scale: int (The minimum scale of the data type on the data source.
1020 *                       If a data type has a fixed scale, the MINIMUM_SCALE and MAXIMUM_SCALE
1021 *                       columns both contain this value. NULL is returned if scale is not applicable.),
1022 *   maximum_scale: int (The maximum scale of the data type on the data source.
1023 *                       NULL is returned if scale is not applicable.),
1024 *   sql_data_type: int not null (The value of the SQL DATA TYPE which has the same values
1025 *                                as data_type value. Except for interval and datetime, which
1026 *                                uses generic values. More info about those types can be
1027 *                                obtained through datetime_subcode. The possible values can be seen
1028 *                                in the XdbcDataType enum.),
1029 *   datetime_subcode: int (Only used when the SQL DATA TYPE is interval or datetime. It contains
1030 *                          its sub types. For type different from interval and datetime, this value
1031 *                          is NULL. The possible values can be seen in the XdbcDatetimeSubcode enum.),
1032 *   num_prec_radix: int (If the data type is an approximate numeric type, this column contains
1033 *                        the value 2 to indicate that COLUMN_SIZE specifies a number of bits. For
1034 *                        exact numeric types, this column contains the value 10 to indicate that
1035 *                        column size specifies a number of decimal digits. Otherwise, this column is NULL.),
1036 *   interval_precision: int (If the data type is an interval data type, then this column contains the value
1037 *                            of the interval leading precision. Otherwise, this column is NULL. This fields
1038 *                            is only relevant to be used by ODBC).
1039 * >
1040 * The returned data should be ordered by data_type and then by type_name.
1041 */
1042message CommandGetXdbcTypeInfo {
1043  option (experimental) = true;
1044
1045  /*
1046   * Specifies the data type to search for the info.
1047   */
1048  optional int32 data_type = 1;
1049}
1050
1051/*
1052 * Represents a request to retrieve the list of catalogs on a Flight SQL enabled backend.
1053 * The definition of a catalog depends on vendor/implementation. It is usually the database itself
1054 * Used in the command member of FlightDescriptor for the following RPC calls:
1055 *  - GetSchema: return the Arrow schema of the query.
1056 *  - GetFlightInfo: execute the catalog metadata request.
1057 *
1058 * The returned Arrow schema will be:
1059 * <
1060 *  catalog_name: utf8 not null
1061 * >
1062 * The returned data should be ordered by catalog_name.
1063 */
1064message CommandGetCatalogs {
1065  option (experimental) = true;
1066}
1067
1068/*
1069 * Represents a request to retrieve the list of database schemas on a Flight SQL enabled backend.
1070 * The definition of a database schema depends on vendor/implementation. It is usually a collection of tables.
1071 * Used in the command member of FlightDescriptor for the following RPC calls:
1072 *  - GetSchema: return the Arrow schema of the query.
1073 *  - GetFlightInfo: execute the catalog metadata request.
1074 *
1075 * The returned Arrow schema will be:
1076 * <
1077 *  catalog_name: utf8,
1078 *  db_schema_name: utf8 not null
1079 * >
1080 * The returned data should be ordered by catalog_name, then db_schema_name.
1081 */
1082message CommandGetDbSchemas {
1083  option (experimental) = true;
1084
1085  /*
1086   * Specifies the Catalog to search for the tables.
1087   * An empty string retrieves those without a catalog.
1088   * If omitted the catalog name should not be used to narrow the search.
1089   */
1090  optional string catalog = 1;
1091
1092  /*
1093   * Specifies a filter pattern for schemas to search for.
1094   * When no db_schema_filter_pattern is provided, the pattern will not be used to narrow the search.
1095   * In the pattern string, two special characters can be used to denote matching rules:
1096   *    - "%" means to match any substring with 0 or more characters.
1097   *    - "_" means to match any one character.
1098   */
1099  optional string db_schema_filter_pattern = 2;
1100}
1101
1102/*
1103 * Represents a request to retrieve the list of tables, and optionally their schemas, on a Flight SQL enabled backend.
1104 * Used in the command member of FlightDescriptor for the following RPC calls:
1105 *  - GetSchema: return the Arrow schema of the query.
1106 *  - GetFlightInfo: execute the catalog metadata request.
1107 *
1108 * The returned Arrow schema will be:
1109 * <
1110 *  catalog_name: utf8,
1111 *  db_schema_name: utf8,
1112 *  table_name: utf8 not null,
1113 *  table_type: utf8 not null,
1114 *  [optional] table_schema: bytes not null (schema of the table as described in Schema.fbs::Schema,
1115 *                                           it is serialized as an IPC message.)
1116 * >
1117 * Fields on table_schema may contain the following metadata:
1118 *  - ARROW:FLIGHT:SQL:CATALOG_NAME      - Table's catalog name
1119 *  - ARROW:FLIGHT:SQL:DB_SCHEMA_NAME    - Database schema name
1120 *  - ARROW:FLIGHT:SQL:TABLE_NAME        - Table name
1121 *  - ARROW:FLIGHT:SQL:TYPE_NAME         - The data source-specific name for the data type of the column.
1122 *  - ARROW:FLIGHT:SQL:PRECISION         - Column precision/size
1123 *  - ARROW:FLIGHT:SQL:SCALE             - Column scale/decimal digits if applicable
1124 *  - ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT - "1" indicates if the column is auto incremented, "0" otherwise.
1125 *  - ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE - "1" indicates if the column is case sensitive, "0" otherwise.
1126 *  - ARROW:FLIGHT:SQL:IS_READ_ONLY      - "1" indicates if the column is read only, "0" otherwise.
1127 *  - ARROW:FLIGHT:SQL:IS_SEARCHABLE     - "1" indicates if the column is searchable via WHERE clause, "0" otherwise.
1128 * The returned data should be ordered by catalog_name, db_schema_name, table_name, then table_type, followed by table_schema if requested.
1129 */
1130message CommandGetTables {
1131  option (experimental) = true;
1132
1133  /*
1134   * Specifies the Catalog to search for the tables.
1135   * An empty string retrieves those without a catalog.
1136   * If omitted the catalog name should not be used to narrow the search.
1137   */
1138  optional string catalog = 1;
1139
1140  /*
1141   * Specifies a filter pattern for schemas to search for.
1142   * When no db_schema_filter_pattern is provided, all schemas matching other filters are searched.
1143   * In the pattern string, two special characters can be used to denote matching rules:
1144   *    - "%" means to match any substring with 0 or more characters.
1145   *    - "_" means to match any one character.
1146   */
1147  optional string db_schema_filter_pattern = 2;
1148
1149  /*
1150   * Specifies a filter pattern for tables to search for.
1151   * When no table_name_filter_pattern is provided, all tables matching other filters are searched.
1152   * In the pattern string, two special characters can be used to denote matching rules:
1153   *    - "%" means to match any substring with 0 or more characters.
1154   *    - "_" means to match any one character.
1155   */
1156  optional string table_name_filter_pattern = 3;
1157
1158  /*
1159   * Specifies a filter of table types which must match.
1160   * The table types depend on vendor/implementation. It is usually used to separate tables from views or system tables.
1161   * TABLE, VIEW, and SYSTEM TABLE are commonly supported.
1162   */
1163  repeated string table_types = 4;
1164
1165  // Specifies if the Arrow schema should be returned for found tables.
1166  bool include_schema = 5;
1167}
1168
1169/*
1170 * Represents a request to retrieve the list of table types on a Flight SQL enabled backend.
1171 * The table types depend on vendor/implementation. It is usually used to separate tables from views or system tables.
1172 * TABLE, VIEW, and SYSTEM TABLE are commonly supported.
1173 * Used in the command member of FlightDescriptor for the following RPC calls:
1174 *  - GetSchema: return the Arrow schema of the query.
1175 *  - GetFlightInfo: execute the catalog metadata request.
1176 *
1177 * The returned Arrow schema will be:
1178 * <
1179 *  table_type: utf8 not null
1180 * >
1181 * The returned data should be ordered by table_type.
1182 */
1183message CommandGetTableTypes {
1184  option (experimental) = true;
1185}
1186
1187/*
1188 * Represents a request to retrieve the primary keys of a table on a Flight SQL enabled backend.
1189 * Used in the command member of FlightDescriptor for the following RPC calls:
1190 *  - GetSchema: return the Arrow schema of the query.
1191 *  - GetFlightInfo: execute the catalog metadata request.
1192 *
1193 * The returned Arrow schema will be:
1194 * <
1195 *  catalog_name: utf8,
1196 *  db_schema_name: utf8,
1197 *  table_name: utf8 not null,
1198 *  column_name: utf8 not null,
1199 *  key_name: utf8,
1200 *  key_sequence: int not null
1201 * >
1202 * The returned data should be ordered by catalog_name, db_schema_name, table_name, key_name, then key_sequence.
1203 */
1204message CommandGetPrimaryKeys {
1205  option (experimental) = true;
1206
1207  /*
1208   * Specifies the catalog to search for the table.
1209   * An empty string retrieves those without a catalog.
1210   * If omitted the catalog name should not be used to narrow the search.
1211   */
1212  optional string catalog = 1;
1213
1214  /*
1215   * Specifies the schema to search for the table.
1216   * An empty string retrieves those without a schema.
1217   * If omitted the schema name should not be used to narrow the search.
1218   */
1219  optional string db_schema = 2;
1220
1221  // Specifies the table to get the primary keys for.
1222  string table = 3;
1223}
1224
1225enum UpdateDeleteRules {
1226  CASCADE = 0;
1227  RESTRICT = 1;
1228  SET_NULL = 2;
1229  NO_ACTION = 3;
1230  SET_DEFAULT = 4;
1231}
1232
1233/*
1234 * Represents a request to retrieve a description of the foreign key columns that reference the given table's
1235 * primary key columns (the foreign keys exported by a table) of a table on a Flight SQL enabled backend.
1236 * Used in the command member of FlightDescriptor for the following RPC calls:
1237 *  - GetSchema: return the Arrow schema of the query.
1238 *  - GetFlightInfo: execute the catalog metadata request.
1239 *
1240 * The returned Arrow schema will be:
1241 * <
1242 *  pk_catalog_name: utf8,
1243 *  pk_db_schema_name: utf8,
1244 *  pk_table_name: utf8 not null,
1245 *  pk_column_name: utf8 not null,
1246 *  fk_catalog_name: utf8,
1247 *  fk_db_schema_name: utf8,
1248 *  fk_table_name: utf8 not null,
1249 *  fk_column_name: utf8 not null,
1250 *  key_sequence: int not null,
1251 *  fk_key_name: utf8,
1252 *  pk_key_name: utf8,
1253 *  update_rule: uint1 not null,
1254 *  delete_rule: uint1 not null
1255 * >
1256 * The returned data should be ordered by fk_catalog_name, fk_db_schema_name, fk_table_name, fk_key_name, then key_sequence.
1257 * update_rule and delete_rule returns a byte that is equivalent to actions declared on UpdateDeleteRules enum.
1258 */
1259message CommandGetExportedKeys {
1260  option (experimental) = true;
1261
1262  /*
1263   * Specifies the catalog to search for the foreign key table.
1264   * An empty string retrieves those without a catalog.
1265   * If omitted the catalog name should not be used to narrow the search.
1266   */
1267  optional string catalog = 1;
1268
1269  /*
1270   * Specifies the schema to search for the foreign key table.
1271   * An empty string retrieves those without a schema.
1272   * If omitted the schema name should not be used to narrow the search.
1273   */
1274  optional string db_schema = 2;
1275
1276  // Specifies the foreign key table to get the foreign keys for.
1277  string table = 3;
1278}
1279
1280/*
1281 * Represents a request to retrieve the foreign keys of a table on a Flight SQL enabled backend.
1282 * Used in the command member of FlightDescriptor for the following RPC calls:
1283 *  - GetSchema: return the Arrow schema of the query.
1284 *  - GetFlightInfo: execute the catalog metadata request.
1285 *
1286 * The returned Arrow schema will be:
1287 * <
1288 *  pk_catalog_name: utf8,
1289 *  pk_db_schema_name: utf8,
1290 *  pk_table_name: utf8 not null,
1291 *  pk_column_name: utf8 not null,
1292 *  fk_catalog_name: utf8,
1293 *  fk_db_schema_name: utf8,
1294 *  fk_table_name: utf8 not null,
1295 *  fk_column_name: utf8 not null,
1296 *  key_sequence: int not null,
1297 *  fk_key_name: utf8,
1298 *  pk_key_name: utf8,
1299 *  update_rule: uint1 not null,
1300 *  delete_rule: uint1 not null
1301 * >
1302 * The returned data should be ordered by pk_catalog_name, pk_db_schema_name, pk_table_name, pk_key_name, then key_sequence.
1303 * update_rule and delete_rule returns a byte that is equivalent to actions:
1304 *    - 0 = CASCADE
1305 *    - 1 = RESTRICT
1306 *    - 2 = SET NULL
1307 *    - 3 = NO ACTION
1308 *    - 4 = SET DEFAULT
1309 */
1310message CommandGetImportedKeys {
1311  option (experimental) = true;
1312
1313  /*
1314   * Specifies the catalog to search for the primary key table.
1315   * An empty string retrieves those without a catalog.
1316   * If omitted the catalog name should not be used to narrow the search.
1317   */
1318  optional string catalog = 1;
1319
1320  /*
1321   * Specifies the schema to search for the primary key table.
1322   * An empty string retrieves those without a schema.
1323   * If omitted the schema name should not be used to narrow the search.
1324   */
1325  optional string db_schema = 2;
1326
1327  // Specifies the primary key table to get the foreign keys for.
1328  string table = 3;
1329}
1330
1331/*
1332 * Represents a request to retrieve a description of the foreign key columns in the given foreign key table that
1333 * reference the primary key or the columns representing a unique constraint of the parent table (could be the same
1334 * or a different table) on a Flight SQL enabled backend.
1335 * Used in the command member of FlightDescriptor for the following RPC calls:
1336 *  - GetSchema: return the Arrow schema of the query.
1337 *  - GetFlightInfo: execute the catalog metadata request.
1338 *
1339 * The returned Arrow schema will be:
1340 * <
1341 *  pk_catalog_name: utf8,
1342 *  pk_db_schema_name: utf8,
1343 *  pk_table_name: utf8 not null,
1344 *  pk_column_name: utf8 not null,
1345 *  fk_catalog_name: utf8,
1346 *  fk_db_schema_name: utf8,
1347 *  fk_table_name: utf8 not null,
1348 *  fk_column_name: utf8 not null,
1349 *  key_sequence: int not null,
1350 *  fk_key_name: utf8,
1351 *  pk_key_name: utf8,
1352 *  update_rule: uint1 not null,
1353 *  delete_rule: uint1 not null
1354 * >
1355 * The returned data should be ordered by pk_catalog_name, pk_db_schema_name, pk_table_name, pk_key_name, then key_sequence.
1356 * update_rule and delete_rule returns a byte that is equivalent to actions:
1357 *    - 0 = CASCADE
1358 *    - 1 = RESTRICT
1359 *    - 2 = SET NULL
1360 *    - 3 = NO ACTION
1361 *    - 4 = SET DEFAULT
1362 */
1363message CommandGetCrossReference {
1364  option (experimental) = true;
1365
1366  /**
1367   * The catalog name where the parent table is.
1368   * An empty string retrieves those without a catalog.
1369   * If omitted the catalog name should not be used to narrow the search.
1370   */
1371  optional string pk_catalog = 1;
1372
1373  /**
1374   * The Schema name where the parent table is.
1375   * An empty string retrieves those without a schema.
1376   * If omitted the schema name should not be used to narrow the search.
1377   */
1378  optional string pk_db_schema = 2;
1379
1380  /**
1381   * The parent table name. It cannot be null.
1382   */
1383  string pk_table = 3;
1384
1385  /**
1386   * The catalog name where the foreign table is.
1387   * An empty string retrieves those without a catalog.
1388   * If omitted the catalog name should not be used to narrow the search.
1389   */
1390  optional string fk_catalog = 4;
1391
1392  /**
1393   * The schema name where the foreign table is.
1394   * An empty string retrieves those without a schema.
1395   * If omitted the schema name should not be used to narrow the search.
1396   */
1397  optional string fk_db_schema = 5;
1398
1399  /**
1400   * The foreign table name. It cannot be null.
1401   */
1402  string fk_table = 6;
1403}
1404
1405// SQL Execution Action Messages
1406
1407/*
1408 * Request message for the "CreatePreparedStatement" action on a Flight SQL enabled backend.
1409 */
1410message ActionCreatePreparedStatementRequest {
1411  option (experimental) = true;
1412
1413  // The valid SQL string to create a prepared statement for.
1414  string query = 1;
1415}
1416
1417/*
1418 * Wrap the result of a "GetPreparedStatement" action.
1419 *
1420 * The resultant PreparedStatement can be closed either:
1421 * - Manually, through the "ClosePreparedStatement" action;
1422 * - Automatically, by a server timeout.
1423 */
1424message ActionCreatePreparedStatementResult {
1425  option (experimental) = true;
1426
1427  // Opaque handle for the prepared statement on the server.
1428  bytes prepared_statement_handle = 1;
1429
1430  // If a result set generating query was provided, dataset_schema contains the
1431  // schema of the dataset as described in Schema.fbs::Schema, it is serialized as an IPC message.
1432  bytes dataset_schema = 2;
1433
1434  // If the query provided contained parameters, parameter_schema contains the
1435  // schema of the expected parameters as described in Schema.fbs::Schema, it is serialized as an IPC message.
1436  bytes parameter_schema = 3;
1437}
1438
1439/*
1440 * Request message for the "ClosePreparedStatement" action on a Flight SQL enabled backend.
1441 * Closes server resources associated with the prepared statement handle.
1442 */
1443message ActionClosePreparedStatementRequest {
1444  option (experimental) = true;
1445
1446  // Opaque handle for the prepared statement on the server.
1447  bytes prepared_statement_handle = 1;
1448}
1449
1450
1451// SQL Execution Messages.
1452
1453/*
1454 * Represents a SQL query. Used in the command member of FlightDescriptor
1455 * for the following RPC calls:
1456 *  - GetSchema: return the Arrow schema of the query.
1457 *    Fields on this schema may contain the following metadata:
1458 *    - ARROW:FLIGHT:SQL:CATALOG_NAME      - Table's catalog name
1459 *    - ARROW:FLIGHT:SQL:DB_SCHEMA_NAME    - Database schema name
1460 *    - ARROW:FLIGHT:SQL:TABLE_NAME        - Table name
1461 *    - ARROW:FLIGHT:SQL:TYPE_NAME         - The data source-specific name for the data type of the column.
1462 *    - ARROW:FLIGHT:SQL:PRECISION         - Column precision/size
1463 *    - ARROW:FLIGHT:SQL:SCALE             - Column scale/decimal digits if applicable
1464 *    - ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT - "1" indicates if the column is auto incremented, "0" otherwise.
1465 *    - ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE - "1" indicates if the column is case sensitive, "0" otherwise.
1466 *    - ARROW:FLIGHT:SQL:IS_READ_ONLY      - "1" indicates if the column is read only, "0" otherwise.
1467 *    - ARROW:FLIGHT:SQL:IS_SEARCHABLE     - "1" indicates if the column is searchable via WHERE clause, "0" otherwise.
1468 *  - GetFlightInfo: execute the query.
1469 */
1470message CommandStatementQuery {
1471  option (experimental) = true;
1472
1473  // The SQL syntax.
1474  string query = 1;
1475}
1476
1477/**
1478 * Represents a ticket resulting from GetFlightInfo with a CommandStatementQuery.
1479 * This should be used only once and treated as an opaque value, that is, clients should not attempt to parse this.
1480 */
1481message TicketStatementQuery {
1482  option (experimental) = true;
1483
1484  // Unique identifier for the instance of the statement to execute.
1485  bytes statement_handle = 1;
1486}
1487
1488/*
1489 * Represents an instance of executing a prepared statement. Used in the command member of FlightDescriptor for
1490 * the following RPC calls:
1491 *  - GetSchema: return the Arrow schema of the query.
1492 *    Fields on this schema may contain the following metadata:
1493 *    - ARROW:FLIGHT:SQL:CATALOG_NAME      - Table's catalog name
1494 *    - ARROW:FLIGHT:SQL:DB_SCHEMA_NAME    - Database schema name
1495 *    - ARROW:FLIGHT:SQL:TABLE_NAME        - Table name
1496 *    - ARROW:FLIGHT:SQL:TYPE_NAME         - The data source-specific name for the data type of the column.
1497 *    - ARROW:FLIGHT:SQL:PRECISION         - Column precision/size
1498 *    - ARROW:FLIGHT:SQL:SCALE             - Column scale/decimal digits if applicable
1499 *    - ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT - "1" indicates if the column is auto incremented, "0" otherwise.
1500 *    - ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE - "1" indicates if the column is case sensitive, "0" otherwise.
1501 *    - ARROW:FLIGHT:SQL:IS_READ_ONLY      - "1" indicates if the column is read only, "0" otherwise.
1502 *    - ARROW:FLIGHT:SQL:IS_SEARCHABLE     - "1" indicates if the column is searchable via WHERE clause, "0" otherwise.
1503 *  - DoPut: bind parameter values. All of the bound parameter sets will be executed as a single atomic execution.
1504 *  - GetFlightInfo: execute the prepared statement instance.
1505 */
1506message CommandPreparedStatementQuery {
1507  option (experimental) = true;
1508
1509  // Opaque handle for the prepared statement on the server.
1510  bytes prepared_statement_handle = 1;
1511}
1512
1513/*
1514 * Represents a SQL update query. Used in the command member of FlightDescriptor
1515 * for the the RPC call DoPut to cause the server to execute the included SQL update.
1516 */
1517message CommandStatementUpdate {
1518  option (experimental) = true;
1519
1520  // The SQL syntax.
1521  string query = 1;
1522}
1523
1524/*
1525 * Represents a SQL update query. Used in the command member of FlightDescriptor
1526 * for the the RPC call DoPut to cause the server to execute the included
1527 * prepared statement handle as an update.
1528 */
1529message CommandPreparedStatementUpdate {
1530  option (experimental) = true;
1531
1532  // Opaque handle for the prepared statement on the server.
1533  bytes prepared_statement_handle = 1;
1534}
1535
1536/*
1537 * Returned from the RPC call DoPut when a CommandStatementUpdate
1538 * CommandPreparedStatementUpdate was in the request, containing
1539 * results from the update.
1540 */
1541message DoPutUpdateResult {
1542  option (experimental) = true;
1543
1544  // The number of records updated. A return value of -1 represents
1545  // an unknown updated record count.
1546  int64 record_count = 1;
1547}
1548
1549extend google.protobuf.MessageOptions {
1550  bool experimental = 1000;
1551}