Sunday, June 11, 2023
HomeBig DataConstructing Information Purposes on the Lakehouse With the Databricks SQL Driver for...

Constructing Information Purposes on the Lakehouse With the Databricks SQL Driver for Node.js

We’re excited to announce the overall availability of the Databricks SQL Driver for NodeJS. This follows the current basic availability of Databricks SQL Driver for GO and the sooner Databricks SQL Connector for Python. Node.js builders can now simply construct knowledge purposes on the lakehouse in pure Javascript or TypeScript.

The NodeJS driver affords easy set up and a versatile interface that makes it straightforward to question knowledge. It additionally routinely converts knowledge sorts between Databricks SQL and Node.js purchasers, eradicating the necessity for boilerplate code.

This weblog publish will use examples of connecting to Databricks and operating queries in opposition to a pattern knowledge set.

Easy set up from npm

With this Node.js driver, there is no must take care of ODBC/JDBC driver dependencies. Set up is thru npm, which suggests you may embrace this connector in your software and use it for CI/CD. On NodeJS 14 or newer:

npm i @databricks/sql

Establishing connection

The connector works with SQL warehouses and All Objective Clusters. This instance reveals you the way to hook up with and run a question on a SQL Warehouse. We import the connector and go in connection and authentication info to ascertain a connection. You possibly can authenticate utilizing a Databricks private entry token (PAT) or a Microsoft Azure lively listing (AAD) token (to be launched shortly).

const { DBSQLClient } = require('@databricks/sql');

const shopper = new DBSQLClient();

    host: '********',
    path: '/sql/1.0/endpoints/****************',
    token: 'dapi********************************',
  .then(async (shopper) => {
    const session = await shopper.openSession();

Querying knowledge

The next instance retrieves an inventory of journeys from the NYC taxi pattern dataset and prints the consequence to the console.

const queryOperation = await session.executeStatement('SELECT trip_distance FROM samples.nyctaxi.journeys', { runAsync: true });
    const consequence = await queryOperation.fetchAll();
    await queryOperation.shut();


    await session.shut();
    await shopper.shut();
  .catch((error) => {

Our documentation consists of examples in Javascript and TypeScript that will help you get began, in addition to the complete API reference.

A shiny future for Node.js builders on the lakehouse

We’re blissful to announce that our Node.js driver is open supply on Github. We welcome contributions from the neighborhood. We’re already seeing our companions, similar to Qlik Analytics, use the Node connector of their merchandise.

We’re much more enthusiastic about what our clients will construct with the Databricks SQL Driver for Node.js! Please check out the motive force and tell us your ideas on Github. We might love to listen to what you prefer to us to assist.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments