The Databricks SQL Driver for NodeJS is a Javascript driver for applications that connect to Databricks clusters and SQL warehouses. This project is a fork of Hive Driver which connects via Thrift API.
For detailed documentation and usage examples, read the Getting Started guide.
- Node.js 14 or newer
npm i @databricks/sqlconst{ DBSQLClient }=require('@databricks/sql');constclient=newDBSQLClient();client.connect({host: '********.databricks.com',path: '/sql/2.0/warehouses/****************',token: 'dapi********************************',}).then(async(client)=>{constsession=awaitclient.openSession();constqueryOperation=awaitsession.executeStatement('SELECT "Hello, World!"');constresult=awaitqueryOperation.fetchAll();awaitqueryOperation.close();console.table(result);awaitsession.close();awaitclient.close();}).catch((error)=>{console.log(error);});You can run all unit tests, or specify a specific test to run:
npm test
npm test<path/to/file.test.js>Before running end-to-end tests, create a file named tests/e2e/utils/config.local.js and set the Databricks SQL connection info:
{host: '***.databricks.com',path: '/sql/2.0/warehouses/***',token: 'dapi***',database: ['catalog','database'],}Then run
npm run e2e
npm run e2e <path/to/file.test.js>See CONTRIBUTING.md
If you find any issues, feel free to create an issue or send a pull request directly.