Class ArrowFlightSqlClientHandler

java.lang.Object
org.apache.arrow.driver.jdbc.client.ArrowFlightSqlClientHandler
All Implemented Interfaces:
AutoCloseable

public final class ArrowFlightSqlClientHandler extends Object implements AutoCloseable
A FlightSqlClient handler.
  • Method Details

    • createNewHandler

      public static ArrowFlightSqlClientHandler createNewHandler(FlightClient client, ArrowFlightSqlClientHandler.Builder builder, Collection<CallOption> options)
      Creates a new ArrowFlightSqlClientHandler from the provided client and options.
      Parameters:
      client - the FlightClient to manage under a FlightSqlClient wrapper.
      options - the CallOptions to persist in between subsequent client calls.
      Returns:
      a new ArrowFlightSqlClientHandler.
    • getStreams

      public List<CloseableEndpointStreamPair> getStreams(FlightInfo flightInfo) throws SQLException
      Makes an RPC "getStream" request based on the provided FlightInfo object. Retrieves the result of the query previously prepared with "getInfo."
      Parameters:
      flightInfo - The FlightInfo instance from which to fetch results.
      Returns:
      a FlightStream of results.
      Throws:
      SQLException
    • getInfo

      public FlightInfo getInfo(String query)
      Makes an RPC "getInfo" request based on the provided query object.
      Parameters:
      query - The query.
      Returns:
      a FlightStream of results.
    • close

      public void close() throws SQLException
      Specified by:
      close in interface AutoCloseable
      Throws:
      SQLException
    • prepare

      Creates a new ArrowFlightSqlClientHandler.PreparedStatement for the given query.
      Parameters:
      query - the SQL query.
      Returns:
      a new prepared statement.
    • getCatalogs

      public FlightInfo getCatalogs()
      Makes an RPC "getCatalogs" request.
      Returns:
      a FlightStream of results.
    • getImportedKeys

      public FlightInfo getImportedKeys(String catalog, String schema, String table)
      Makes an RPC "getImportedKeys" request based on the provided info.
      Parameters:
      catalog - The catalog name. Must match the catalog name as it is stored in the database. Retrieves those without a catalog. Null means that the catalog name should not be used to narrow the search.
      schema - The schema name. Must match the schema name as it is stored in the database. "" retrieves those without a schema. Null means that the schema name should not be used to narrow the search.
      table - The table name. Must match the table name as it is stored in the database.
      Returns:
      a FlightStream of results.
    • getExportedKeys

      public FlightInfo getExportedKeys(String catalog, String schema, String table)
      Makes an RPC "getExportedKeys" request based on the provided info.
      Parameters:
      catalog - The catalog name. Must match the catalog name as it is stored in the database. Retrieves those without a catalog. Null means that the catalog name should not be used to narrow the search.
      schema - The schema name. Must match the schema name as it is stored in the database. "" retrieves those without a schema. Null means that the schema name should not be used to narrow the search.
      table - The table name. Must match the table name as it is stored in the database.
      Returns:
      a FlightStream of results.
    • getSchemas

      public FlightInfo getSchemas(String catalog, String schemaPattern)
      Makes an RPC "getSchemas" request based on the provided info.
      Parameters:
      catalog - The catalog name. Must match the catalog name as it is stored in the database. Retrieves those without a catalog. Null means that the catalog name should not be used to narrow the search.
      schemaPattern - The schema name pattern. Must match the schema name as it is stored in the database. Null means that schema name should not be used to narrow down the search.
      Returns:
      a FlightStream of results.
    • getTableTypes

      public FlightInfo getTableTypes()
      Makes an RPC "getTableTypes" request.
      Returns:
      a FlightStream of results.
    • getTables

      public FlightInfo getTables(String catalog, String schemaPattern, String tableNamePattern, List<String> types, boolean includeSchema)
      Makes an RPC "getTables" request based on the provided info.
      Parameters:
      catalog - The catalog name. Must match the catalog name as it is stored in the database. Retrieves those without a catalog. Null means that the catalog name should not be used to narrow the search.
      schemaPattern - The schema name pattern. Must match the schema name as it is stored in the database. "" retrieves those without a schema. Null means that the schema name should not be used to narrow the search.
      tableNamePattern - The table name pattern. Must match the table name as it is stored in the database.
      types - The list of table types, which must be from the list of table types to include. Null returns all types.
      includeSchema - Whether to include schema.
      Returns:
      a FlightStream of results.
    • getSqlInfo

      public FlightInfo getSqlInfo(FlightSql.SqlInfo... info)
      Gets SQL info.
      Returns:
      the SQL info.
    • getPrimaryKeys

      public FlightInfo getPrimaryKeys(String catalog, String schema, String table)
      Makes an RPC "getPrimaryKeys" request based on the provided info.
      Parameters:
      catalog - The catalog name; must match the catalog name as it is stored in the database. "" retrieves those without a catalog. Null means that the catalog name should not be used to narrow the search.
      schema - The schema name; must match the schema name as it is stored in the database. "" retrieves those without a schema. Null means that the schema name should not be used to narrow the search.
      table - The table name. Must match the table name as it is stored in the database.
      Returns:
      a FlightStream of results.
    • getCrossReference

      public FlightInfo getCrossReference(String pkCatalog, String pkSchema, String pkTable, String fkCatalog, String fkSchema, String fkTable)
      Makes an RPC "getCrossReference" request based on the provided info.
      Parameters:
      pkCatalog - The catalog name. Must match the catalog name as it is stored in the database. Retrieves those without a catalog. Null means that the catalog name should not be used to narrow the search.
      pkSchema - The schema name. Must match the schema name as it is stored in the database. "" retrieves those without a schema. Null means that the schema name should not be used to narrow the search.
      pkTable - The table name. Must match the table name as it is stored in the database.
      fkCatalog - The catalog name. Must match the catalog name as it is stored in the database. Retrieves those without a catalog. Null means that the catalog name should not be used to narrow the search.
      fkSchema - The schema name. Must match the schema name as it is stored in the database. "" retrieves those without a schema. Null means that the schema name should not be used to narrow the search.
      fkTable - The table name. Must match the table name as it is stored in the database.
      Returns:
      a FlightStream of results.