Package com.databricks.jdbc.dbclient

## Interface IDatabricksClient

All Known Implementing Classes:
  `DatabricksSdkClient`, `DatabricksThriftServiceClient`

    public interface IDatabricksClient

Interface for Databricks client which abstracts the integration with Databricks server.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `cancelStatement​(StatementId statementId)` Cancels a statement in Databricks server
`void` `closeStatement​(StatementId statementId)` Closes a statement in Databricks server
`ImmutableSessionInfo` `createSession​(IDatabricksComputeResource computeResource, String catalog, String schema, Map<String,​String> sessionConf)` Creates a new session for given warehouse-Id, catalog and session.
`void` `deleteSession​(ImmutableSessionInfo sessionInfo)` Deletes a session for given session-Id
`DatabricksResultSet` `executeStatement​(String sql, IDatabricksComputeResource computeResource, Map<Integer,​ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatementInternal parentStatement)` Executes a statement in Databricks server
`DatabricksResultSet` `executeStatementAsync​(String sql, IDatabricksComputeResource computeResource, Map<Integer,​ImmutableSqlParameter> parameters, IDatabricksSession session, IDatabricksStatementInternal parentStatement)` Executes a statement in Databricks server asynchronously
`IDatabricksConnectionContext` `getConnectionContext()`
`TFetchResultsResp` `getMoreResults​(IDatabricksStatementInternal parentStatement)`
`Collection<ExternalLink>` `getResultChunks​(StatementId statementId, long chunkIndex)` Fetches the chunk details for given chunk index and statement-Id.
`DatabricksResultSet` `getStatementResult​(StatementId statementId, IDatabricksSession session, IDatabricksStatementInternal parentStatement)` Fetches result for underlying statement-Id
`void` `resetAccessToken​(String newAccessToken)` Update the access token based on new value provided by the customer

### Method Detail

#### createSession

    ImmutableSessionInfo createSession​(IDatabricksComputeResource computeResource,
                                       String catalog,
                                       String schema,
                                       Map<String,​String> sessionConf)
                                throws DatabricksSQLException

Creates a new session for given warehouse-Id, catalog and session.

Parameters:
  `computeResource` - underlying SQL-warehouse or all-purpose cluster
  `catalog` - for the session
  `schema` - for the session
  `sessionConf` - session configuration
Returns:
  created session
Throws:
  `DatabricksSQLException`

#### deleteSession

    void deleteSession​(ImmutableSessionInfo sessionInfo)
                throws DatabricksSQLException

Deletes a session for given session-Id

Parameters:
  `sessionInfo` - for which the session should be deleted
Throws:
  `DatabricksSQLException`

#### executeStatement

    DatabricksResultSet executeStatement​(String sql,
                                         IDatabricksComputeResource computeResource,
                                         Map<Integer,​ImmutableSqlParameter> parameters,
                                         StatementType statementType,
                                         IDatabricksSession session,
                                         IDatabricksStatementInternal parentStatement)
                                  throws SQLException

Executes a statement in Databricks server

Parameters:
  `sql` - SQL statement that needs to be executed
  `computeResource` - underlying SQL-warehouse or all-purpose cluster
  `parameters` - SQL parameters for the statement
  `statementType` - type of statement (metadata, update or generic SQL)
  `session` - underlying session
  `parentStatement` - statement instance if called from a statement
Returns:
  response for statement execution
Throws:
  `SQLException`

#### executeStatementAsync

    DatabricksResultSet executeStatementAsync​(String sql,
                                              IDatabricksComputeResource computeResource,
                                              Map<Integer,​ImmutableSqlParameter> parameters,
                                              IDatabricksSession session,
                                              IDatabricksStatementInternal parentStatement)
                                       throws SQLException

Executes a statement in Databricks server asynchronously

Parameters:
  `sql` - SQL statement that needs to be executed
  `computeResource` - underlying SQL-warehouse or all-purpose cluster
  `parameters` - SQL parameters for the statement
  `session` - underlying session
  `parentStatement` - statement instance if called from a statement
Returns:
  response for statement execution
Throws:
  `SQLException`

#### closeStatement

    void closeStatement​(StatementId statementId)
                 throws DatabricksSQLException

Closes a statement in Databricks server

Parameters:
  `statementId` - statement which should be closed
Throws:
  `DatabricksSQLException`

#### cancelStatement

    void cancelStatement​(StatementId statementId)
                  throws DatabricksSQLException

Cancels a statement in Databricks server

Parameters:
  `statementId` - statement which should be aborted
Throws:
  `DatabricksSQLException`

#### getStatementResult

    DatabricksResultSet getStatementResult​(StatementId statementId,
                                           IDatabricksSession session,
                                           IDatabricksStatementInternal parentStatement)
                                    throws SQLException

Fetches result for underlying statement-Id

Parameters:
  `statementId` - statement which should be checked for status
  `session` - underlying session
  `parentStatement` - statement instance
Throws:
  `SQLException`

#### getResultChunks

    Collection<ExternalLink> getResultChunks​(StatementId statementId,
                                             long chunkIndex)
                                      throws DatabricksSQLException

Fetches the chunk details for given chunk index and statement-Id.

Parameters:
  `statementId` - statement-Id for which chunk should be fetched
  `chunkIndex` - chunkIndex for which chunk should be fetched
Throws:
  `DatabricksSQLException`

#### getConnectionContext

    IDatabricksConnectionContext getConnectionContext()

#### resetAccessToken

    void resetAccessToken​(String newAccessToken)

Update the access token based on new value provided by the customer

Parameters:
  `newAccessToken` - new access token value

#### getMoreResults

    TFetchResultsResp getMoreResults​(IDatabricksStatementInternal parentStatement)
                              throws DatabricksSQLException

Throws:
  `DatabricksSQLException`