Class DatabricksThriftServiceClient
- java.lang.Object
-
- com.databricks.jdbc.dbclient.impl.thrift.DatabricksThriftServiceClient
-
- All Implemented Interfaces:
IDatabricksClient,IDatabricksMetadataClient
public class DatabricksThriftServiceClient extends Object implements IDatabricksClient, IDatabricksMetadataClient
-
-
Constructor Summary
Constructors Constructor Description DatabricksThriftServiceClient(IDatabricksConnectionContext connectionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelStatement(StatementId statementId)Cancels a statement in Databricks servervoidcloseStatement(StatementId statementId)Closes a statement in Databricks serverImmutableSessionInfocreateSession(IDatabricksComputeResource cluster, 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 statementId, long chunkIndex)Fetches the chunk details for given chunk index and statement-Id.DatabricksResultSetgetStatementResult(StatementId statementId, IDatabricksSession session, IDatabricksStatementInternal parentStatement)Fetches result for underlying statement-IdDatabricksResultSetlistCatalogs(IDatabricksSession session)Returns the list of catalogsDatabricksResultSetlistColumns(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String columnNamePattern)Returns the list of columnsDatabricksResultSetlistCrossReferences(IDatabricksSession session, String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable)Returns the list of cross references between a parent table and a foreign tableDatabricksResultSetlistExportedKeys(IDatabricksSession session, String catalog, String schema, String table)Returns the list of imported keysDatabricksResultSetlistFunctions(IDatabricksSession session, String catalog, String schemaNamePattern, String functionNamePattern)Returns the list of functionsDatabricksResultSetlistImportedKeys(IDatabricksSession session, String catalog, String schema, String table)Returns the list of imported keysDatabricksResultSetlistPrimaryKeys(IDatabricksSession session, String catalog, String schema, String table)Returns the list of primary keysDatabricksResultSetlistSchemas(IDatabricksSession session, String catalog, String schemaNamePattern)Returns the list of schemasDatabricksResultSetlistTables(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String[] tableTypes)Returns the list of tablesDatabricksResultSetlistTableTypes(IDatabricksSession session)Returns list of table typesDatabricksResultSetlistTypeInfo(IDatabricksSession session)Returns information about types supported by Databricks servervoidresetAccessToken(String newAccessToken)Update the access token based on new value provided by the customer
-
-
-
Constructor Detail
-
DatabricksThriftServiceClient
public DatabricksThriftServiceClient(IDatabricksConnectionContext connectionContext) throws DatabricksParsingException
- Throws:
DatabricksParsingException
-
-
Method Detail
-
getConnectionContext
public IDatabricksConnectionContext getConnectionContext()
- Specified by:
getConnectionContextin interfaceIDatabricksClient
-
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
-
createSession
public ImmutableSessionInfo createSession(IDatabricksComputeResource cluster, 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:
cluster- 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
-
closeStatement
public void closeStatement(StatementId statementId) throws DatabricksSQLException
Description copied from interface:IDatabricksClientCloses a statement in Databricks server- Specified by:
closeStatementin interfaceIDatabricksClient- Parameters:
statementId- statement which should be closed- Throws:
DatabricksSQLException
-
cancelStatement
public void cancelStatement(StatementId statementId) throws DatabricksSQLException
Description copied from interface:IDatabricksClientCancels a statement in Databricks server- Specified by:
cancelStatementin interfaceIDatabricksClient- Parameters:
statementId- statement which should be aborted- Throws:
DatabricksSQLException
-
getStatementResult
public DatabricksResultSet getStatementResult(StatementId statementId, IDatabricksSession session, IDatabricksStatementInternal parentStatement) throws SQLException
Description copied from interface:IDatabricksClientFetches result for underlying statement-Id- Specified by:
getStatementResultin interfaceIDatabricksClient- Parameters:
statementId- statement which should be checked for statussession- underlying sessionparentStatement- statement instance- Throws:
SQLException
-
getResultChunks
public Collection<ExternalLink> getResultChunks(StatementId statementId, long chunkIndex) throws DatabricksSQLException
Description copied from interface:IDatabricksClientFetches the chunk details for given chunk index and statement-Id.- Specified by:
getResultChunksin interfaceIDatabricksClient- Parameters:
statementId- statement-Id for which chunk should be fetchedchunkIndex- chunkIndex for which chunk should be fetched- Throws:
DatabricksSQLException
-
listTypeInfo
public DatabricksResultSet listTypeInfo(IDatabricksSession session)
Description copied from interface:IDatabricksMetadataClientReturns information about types supported by Databricks server- Specified by:
listTypeInfoin interfaceIDatabricksMetadataClient
-
listCatalogs
public DatabricksResultSet listCatalogs(IDatabricksSession session) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of catalogs- Specified by:
listCatalogsin interfaceIDatabricksMetadataClient- Throws:
SQLException
-
listSchemas
public DatabricksResultSet listSchemas(IDatabricksSession session, String catalog, String schemaNamePattern) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of schemas- Specified by:
listSchemasin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschemaNamePattern- must match to schema name in database (can be a regex pattern or absolute name)- Returns:
- a DatabricksResultSet representing list of schemas
- Throws:
SQLException
-
listTables
public DatabricksResultSet listTables(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String[] tableTypes) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of tables- Specified by:
listTablesin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschemaNamePattern- must match to schema name in database (can be a regex pattern or absolute name)tableNamePattern- must match to table name in database (can be a regex pattern or absolute name)- Returns:
- a DatabricksResultSet representing list of tables
- Throws:
SQLException
-
listTableTypes
public DatabricksResultSet listTableTypes(IDatabricksSession session)
Description copied from interface:IDatabricksMetadataClientReturns list of table types- Specified by:
listTableTypesin interfaceIDatabricksMetadataClient
-
listColumns
public DatabricksResultSet listColumns(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String columnNamePattern) throws DatabricksSQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of columns- Specified by:
listColumnsin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschemaNamePattern- must match to schema name in database (can be a regex pattern or absolute name)tableNamePattern- must match to table name in database (can be a regex pattern or absolute name)columnNamePattern- must match to column name in database (can be a regex pattern or absolute name)- Returns:
- a DatabricksResultSet representing list of columns
- Throws:
DatabricksSQLException
-
listFunctions
public DatabricksResultSet listFunctions(IDatabricksSession session, String catalog, String schemaNamePattern, String functionNamePattern) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of functions- Specified by:
listFunctionsin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschemaNamePattern- must match to schema name in database (can be a regex pattern or absolute name)functionNamePattern- must match to function name in database (can be a regex pattern or absolute name)- Returns:
- a DatabricksResultSet representing list of functions
- Throws:
SQLException
-
listPrimaryKeys
public DatabricksResultSet listPrimaryKeys(IDatabricksSession session, String catalog, String schema, String table) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of primary keys- Specified by:
listPrimaryKeysin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschema- must match to a schema in databasetable- must match to a table in database- Returns:
- a DatabricksResultSet representing list of functions
- Throws:
SQLException
-
listImportedKeys
public DatabricksResultSet listImportedKeys(IDatabricksSession session, String catalog, String schema, String table) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of imported keys- Specified by:
listImportedKeysin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschema- must match to a schema in databasetable- must match to a table in database- Returns:
- a DatabricksResultSet representing list of imported keys
- Throws:
SQLException
-
listExportedKeys
public DatabricksResultSet listExportedKeys(IDatabricksSession session, String catalog, String schema, String table) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of imported keys- Specified by:
listExportedKeysin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschema- must match to a schema in databasetable- must match to a table in database- Returns:
- a DatabricksResultSet representing list of imported keys
- Throws:
SQLException
-
listCrossReferences
public DatabricksResultSet listCrossReferences(IDatabricksSession session, String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of cross references between a parent table and a foreign table- Specified by:
listCrossReferencesin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessionparentCatalog- catalogName which must match to catalog in databaseparentSchema- must match to a schema in databaseparentTable- must match to a table in databaseforeignCatalog- catalogName which must match to foreign catalog in databaseforeignSchema- must match to a foreign schema in databaseforeignTable- must match to a foreign table in database- Returns:
- a DatabricksResultSet representing list of cross references
- Throws:
SQLException
-
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
-
-