Class DatabricksSdkClient
java.lang.Object
com.databricks.jdbc.dbclient.impl.sqlexec.DatabricksSdkClient
- All Implemented Interfaces:
IDatabricksClient
Implementation of IDatabricksClient interface using Databricks Java SDK.
-
Constructor Summary
ConstructorsConstructorDescriptionDatabricksSdkClient(IDatabricksConnectionContext connectionContext) DatabricksSdkClient(IDatabricksConnectionContext connectionContext, com.databricks.sdk.service.sql.StatementExecutionService statementExecutionService, com.databricks.sdk.core.ApiClient apiClient) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelStatement(StatementId typedStatementId) Cancels a statement in Databricks servervoidcloseStatement(StatementId typedStatementId) Closes a statement in Databricks servercreateSession(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-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 typedStatementId, long chunkIndex) Fetches the chunk details for given chunk index and statement-Id.getStatementResult(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 Details
-
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 Details
-
getConnectionContext
- Specified by:
getConnectionContextin interfaceIDatabricksClient
-
createSession
public ImmutableSessionInfo createSession(IDatabricksComputeResource warehouse, String catalog, String schema, Map<String, String> sessionConf) throws DatabricksSQLExceptionDescription 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
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 SQLExceptionDescription 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 SQLExceptionDescription 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
Description copied from interface:IDatabricksClientCloses a statement in Databricks server- Specified by:
closeStatementin interfaceIDatabricksClient- Parameters:
typedStatementId- statement which should be closed- Throws:
DatabricksSQLException
-
cancelStatement
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
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
-