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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelStatement(StatementId typedStatementId)Cancels a statement in Databricks servervoidcloseStatement(StatementId typedStatementId)Closes a statement in Databricks serverImmutableSessionInfocreateSession(IDatabricksComputeResource warehouse, String catalog, String schema, Map<String,String> sessionConf)Creates a new session for given warehouse-Id, catalog and session.voiddeleteSession(ImmutableSessionInfo sessionInfo)Deletes a session for given session-IdDatabricksResultSetexecuteStatement(String sql, IDatabricksComputeResource computeResource, Map<Integer,ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatementInternal parentStatement)Executes a statement in Databricks serverDatabricksResultSetexecuteStatementAsync(String sql, IDatabricksComputeResource computeResource, Map<Integer,ImmutableSqlParameter> parameters, IDatabricksSession session, IDatabricksStatementInternal parentStatement)Executes a statement in Databricks server asynchronouslyIDatabricksConnectionContextgetConnectionContext()com.databricks.sdk.core.DatabricksConfiggetDatabricksConfig()Retrieves underlying DatabricksConfigTFetchResultsRespgetMoreResults(IDatabricksStatementInternal parentStatement)Collection<ExternalLink>getResultChunks(StatementId typedStatementId, long chunkIndex)Fetches the chunk details for given chunk index and statement-Id.DatabricksResultSetgetStatementResult(StatementId typedStatementId, IDatabricksSession session, IDatabricksStatementInternal parentStatement)Fetches result for underlying statement-IdvoidresetAccessToken(String newAccessToken)Update the access token based on new value provided by the customer
-
-
-
Constructor Detail
-
DatabricksSdkClient
public DatabricksSdkClient(IDatabricksConnectionContext connectionContext) throws DatabricksParsingException, DatabricksHttpException
-
DatabricksSdkClient
public DatabricksSdkClient(IDatabricksConnectionContext connectionContext, com.databricks.sdk.service.sql.StatementExecutionService statementExecutionService, com.databricks.sdk.core.ApiClient apiClient) throws DatabricksParsingException, DatabricksHttpException
-
-
Method Detail
-
getConnectionContext
public IDatabricksConnectionContext getConnectionContext()
- Specified by:
getConnectionContextin interfaceIDatabricksClient
-
createSession
public ImmutableSessionInfo createSession(IDatabricksComputeResource warehouse, String catalog, String schema, Map<String,String> sessionConf) throws DatabricksSQLException
Description copied from interface:IDatabricksClientCreates a new session for given warehouse-Id, catalog and session.- Specified by:
createSessionin interfaceIDatabricksClient- Parameters:
warehouse- underlying SQL-warehouse or all-purpose clustercatalog- for the sessionschema- for the sessionsessionConf- session configuration- Returns:
- created session
- Throws:
DatabricksSQLException
-
deleteSession
public void deleteSession(ImmutableSessionInfo sessionInfo) throws DatabricksSQLException
Description copied from interface:IDatabricksClientDeletes a session for given session-Id- Specified by:
deleteSessionin interfaceIDatabricksClient- 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:IDatabricksClientExecutes a statement in Databricks server- Specified by:
executeStatementin interfaceIDatabricksClient- Parameters:
sql- SQL statement that needs to be executedcomputeResource- underlying SQL-warehouse or all-purpose clusterparameters- SQL parameters for the statementstatementType- type of statement (metadata, update or generic SQL)session- underlying sessionparentStatement- 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:IDatabricksClientExecutes a statement in Databricks server asynchronously- Specified by:
executeStatementAsyncin interfaceIDatabricksClient- Parameters:
sql- SQL statement that needs to be executedcomputeResource- underlying SQL-warehouse or all-purpose clusterparameters- SQL parameters for the statementsession- underlying sessionparentStatement- 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:IDatabricksClientFetches result for underlying statement-Id- Specified by:
getStatementResultin interfaceIDatabricksClient- Parameters:
typedStatementId- statement which should be checked for statussession- underlying sessionparentStatement- statement instance- Throws:
DatabricksSQLException
-
closeStatement
public void closeStatement(StatementId typedStatementId) throws DatabricksSQLException
Description copied from interface:IDatabricksClientCloses a statement in Databricks server- Specified by:
closeStatementin interfaceIDatabricksClient- Parameters:
typedStatementId- statement which should be closed- Throws:
DatabricksSQLException
-
cancelStatement
public void cancelStatement(StatementId typedStatementId) throws DatabricksSQLException
Description copied from interface:IDatabricksClientCancels a statement in Databricks server- Specified by:
cancelStatementin interfaceIDatabricksClient- Parameters:
typedStatementId- statement which should be aborted- Throws:
DatabricksSQLException
-
getResultChunks
public Collection<ExternalLink> getResultChunks(StatementId typedStatementId, long chunkIndex) throws DatabricksSQLException
Description copied from interface:IDatabricksClientFetches the chunk details for given chunk index and statement-Id.- Specified by:
getResultChunksin interfaceIDatabricksClient- Parameters:
typedStatementId- statement-Id for which chunk should be fetchedchunkIndex- chunkIndex for which chunk should be fetched- Throws:
DatabricksSQLException
-
resetAccessToken
public void resetAccessToken(String newAccessToken)
Description copied from interface:IDatabricksClientUpdate the access token based on new value provided by the customer- Specified by:
resetAccessTokenin interfaceIDatabricksClient- Parameters:
newAccessToken- new access token value
-
getMoreResults
public TFetchResultsResp getMoreResults(IDatabricksStatementInternal parentStatement) throws DatabricksSQLException
- Specified by:
getMoreResultsin interfaceIDatabricksClient- Throws:
DatabricksSQLException
-
getDatabricksConfig
public com.databricks.sdk.core.DatabricksConfig getDatabricksConfig()
Description copied from interface:IDatabricksClientRetrieves underlying DatabricksConfig- Specified by:
getDatabricksConfigin interfaceIDatabricksClient
-
-