Interface IDatabricksClient
- All Known Implementing Classes:
DatabricksSdkClient,DatabricksThriftServiceClient
public interface IDatabricksClient
Interface for Databricks client which abstracts the integration with Databricks server.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcancelStatement(StatementId statementId) Cancels a statement in Databricks servervoidcloseStatement(StatementId statementId) Closes a statement in Databricks servercreateSession(IDatabricksComputeResource computeResource, 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-IdexecuteStatement(String sql, IDatabricksComputeResource computeResource, Map<Integer, ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatementInternal parentStatement) Executes a statement in Databricks serverexecuteStatementAsync(String sql, IDatabricksComputeResource computeResource, Map<Integer, ImmutableSqlParameter> parameters, IDatabricksSession session, IDatabricksStatementInternal parentStatement) Executes a statement in Databricks server asynchronouslycom.databricks.sdk.core.DatabricksConfigRetrieves underlying DatabricksConfiggetMoreResults(IDatabricksStatementInternal parentStatement) getResultChunks(StatementId statementId, long chunkIndex) Fetches the chunk details for given chunk index and statement-Id.getStatementResult(StatementId statementId, IDatabricksSession session, IDatabricksStatementInternal parentStatement) Fetches result for underlying statement-IdvoidresetAccessToken(String newAccessToken) Update the access token based on new value provided by the customer
-
Method Details
-
createSession
ImmutableSessionInfo createSession(IDatabricksComputeResource computeResource, String catalog, String schema, Map<String, String> sessionConf) throws DatabricksSQLExceptionCreates a new session for given warehouse-Id, catalog and session.- Parameters:
computeResource- underlying SQL-warehouse or all-purpose clustercatalog- for the sessionschema- for the sessionsessionConf- session configuration- Returns:
- created session
- Throws:
DatabricksSQLException
-
deleteSession
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 SQLExceptionExecutes a statement in Databricks server- 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
DatabricksResultSet executeStatementAsync(String sql, IDatabricksComputeResource computeResource, Map<Integer, ImmutableSqlParameter> parameters, IDatabricksSession session, IDatabricksStatementInternal parentStatement) throws SQLExceptionExecutes a statement in Databricks server asynchronously- 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
-
closeStatement
Closes a statement in Databricks server- Parameters:
statementId- statement which should be closed- Throws:
DatabricksSQLException
-
cancelStatement
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 statussession- underlying sessionparentStatement- 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 fetchedchunkIndex- chunkIndex for which chunk should be fetched- Throws:
DatabricksSQLException
-
getConnectionContext
IDatabricksConnectionContext getConnectionContext() -
resetAccessToken
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
-
getDatabricksConfig
com.databricks.sdk.core.DatabricksConfig getDatabricksConfig()Retrieves underlying DatabricksConfig
-