snippets_js
Integration
New integration from credential
const databricksClient = yepcode.integration.databricks("credential-slug");
New integration from plain authentication data
const { DBSQLClient } = require('@databricks/sql');
const databricksClient = new DBSQLClient();
await databricksClient
.connect({
host: 'host',
path: 'path',
token: 'token',
})
Execute Query
Execute query
const session = await databricksClient.openSession();
const queryOperation = await session.executeStatement(
'SELECT "Hello, World!"',
{ runAsync: true }
);
const result = await queryOperation.fetchAll();
await queryOperation.close();
console.table(result);
await session.close();
await databricksClient.close();
Execute Insert
Execute insert
const session = await databricksClient.openSession();
const createTableOperation = await session.executeStatement(
'CREATE TABLE IF NOT EXISTS pokes (foo INT, bar STRING)',
);
await createTableOperation.fetchAll();
await createTableOperation.close();
await session.close();
await databricksClient.close();