# Class DatabricksSdkClient

java.lang.Object
com.databricks.jdbc.dbclient.impl.sqlexec.DatabricksSdkClient

All Implemented Interfaces:
  `IDatabricksClient`

public class DatabricksSdkClient extends Object implements IDatabricksClient
Implementation of IDatabricksClient interface using Databricks Java SDK.

## Constructor Summary

Constructors
Constructor
Description
`DatabricksSdkClient(IDatabricksConnectionContext connectionContext)`
`DatabricksSdkClient(IDatabricksConnectionContext connectionContext, com.databricks.sdk.service.sql.StatementExecutionService statementExecutionService, com.databricks.sdk.core.ApiClient apiClient)`

## Method Summary

Modifier and Type
Method
Description
`void`
`cancelStatement(StatementId typedStatementId)`
Cancels a statement in Databricks server
`void`
`closeStatement(StatementId typedStatementId)`
Closes a statement in Databricks server
`ImmutableSessionInfo`
`createSession(IDatabricksComputeResource warehouse, 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()`
`com.databricks.sdk.core.DatabricksConfig`
`getDatabricksConfig()`
Retrieves underlying DatabricksConfig
`TFetchResultsResp`
`getMoreResults(IDatabricksStatementInternal parentStatement)`
`Collection<ExternalLink>`
`getResultChunks(StatementId typedStatementId, long chunkIndex)`
Fetches the chunk details for given chunk index and statement-Id.
`DatabricksResultSet`
`getStatementResult(StatementId typedStatementId, 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

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DatabricksSdkClient

public DatabricksSdkClient(IDatabricksConnectionContext connectionContext) throws DatabricksParsingException, DatabricksHttpException

Throws:
  `DatabricksParsingException`
  `DatabricksHttpException`

### DatabricksSdkClient

public DatabricksSdkClient(IDatabricksConnectionContext connectionContext, com.databricks.sdk.service.sql.StatementExecutionService statementExecutionService, com.databricks.sdk.core.ApiClient apiClient) throws DatabricksParsingException, DatabricksHttpException

Throws:
  `DatabricksParsingException`
  `DatabricksHttpException`

## Method Details

### getConnectionContext

public IDatabricksConnectionContext getConnectionContext()

Specified by:
  `getConnectionContext` in interface `IDatabricksClient`

### createSession

public ImmutableSessionInfo createSession(IDatabricksComputeResource warehouse, String catalog, String schema, Map<String,String> sessionConf) throws DatabricksSQLException
Description copied from interface: `IDatabricksClient`
Creates a new session for given warehouse-Id, catalog and session.

Specified by:
  `createSession` in interface `IDatabricksClient`
Parameters:
  `warehouse` - underlying SQL-warehouse or all-purpose cluster
  `catalog` - for the session
  `schema` - for the session
  `sessionConf` - session configuration
Returns:
  created session
Throws:
  `DatabricksSQLException`

### deleteSession

public void deleteSession(ImmutableSessionInfo sessionInfo) throws DatabricksSQLException
Description copied from interface: `IDatabricksClient`
Deletes a session for given session-Id

Specified by:
  `deleteSession` in interface `IDatabricksClient`
Parameters:
  `sessionInfo` - for which the session should be deleted
Throws:
  `DatabricksSQLException`

### executeStatement

public DatabricksResultSet executeStatement(String sql, IDatabricksComputeResource computeResource, Map<Integer,ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatementInternal parentStatement) throws SQLException
Description copied from interface: `IDatabricksClient`
Executes a statement in Databricks server

Specified by:
  `executeStatement` in interface `IDatabricksClient`
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

public DatabricksResultSet executeStatementAsync(String sql, IDatabricksComputeResource computeResource, Map<Integer,ImmutableSqlParameter> parameters, IDatabricksSession session, IDatabricksStatementInternal parentStatement) throws SQLException
Description copied from interface: `IDatabricksClient`
Executes a statement in Databricks server asynchronously

Specified by:
  `executeStatementAsync` in interface `IDatabricksClient`
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`

### getStatementResult

public DatabricksResultSet getStatementResult(StatementId typedStatementId, IDatabricksSession session, IDatabricksStatementInternal parentStatement) throws DatabricksSQLException
Description copied from interface: `IDatabricksClient`
Fetches result for underlying statement-Id

Specified by:
  `getStatementResult` in interface `IDatabricksClient`
Parameters:
  `typedStatementId` - statement which should be checked for status
  `session` - underlying session
  `parentStatement` - statement instance
Throws:
  `DatabricksSQLException`

### closeStatement

public void closeStatement(StatementId typedStatementId) throws DatabricksSQLException
Description copied from interface: `IDatabricksClient`
Closes a statement in Databricks server

Specified by:
  `closeStatement` in interface `IDatabricksClient`
Parameters:
  `typedStatementId` - statement which should be closed
Throws:
  `DatabricksSQLException`

### cancelStatement

public void cancelStatement(StatementId typedStatementId) throws DatabricksSQLException
Description copied from interface: `IDatabricksClient`
Cancels a statement in Databricks server

Specified by:
  `cancelStatement` in interface `IDatabricksClient`
Parameters:
  `typedStatementId` - statement which should be aborted
Throws:
  `DatabricksSQLException`

### getResultChunks

public Collection<ExternalLink> getResultChunks(StatementId typedStatementId, long chunkIndex) throws DatabricksSQLException
Description copied from interface: `IDatabricksClient`
Fetches the chunk details for given chunk index and statement-Id.

Specified by:
  `getResultChunks` in interface `IDatabricksClient`
Parameters:
  `typedStatementId` - statement-Id for which chunk should be fetched
  `chunkIndex` - chunkIndex for which chunk should be fetched
Throws:
  `DatabricksSQLException`

### resetAccessToken

public void resetAccessToken(String newAccessToken)
Description copied from interface: `IDatabricksClient`
Update the access token based on new value provided by the customer

Specified by:
  `resetAccessToken` in interface `IDatabricksClient`
Parameters:
  `newAccessToken` - new access token value

### getMoreResults

public TFetchResultsResp getMoreResults(IDatabricksStatementInternal parentStatement) throws DatabricksSQLException

Specified by:
  `getMoreResults` in interface `IDatabricksClient`
Throws:
  `DatabricksSQLException`

### getDatabricksConfig

public com.databricks.sdk.core.DatabricksConfig getDatabricksConfig()
Description copied from interface: `IDatabricksClient`
Retrieves underlying DatabricksConfig

Specified by:
  `getDatabricksConfig` in interface `IDatabricksClient`