Home Reference Source Test

redash-client

JavaScript Client for Redash API

npm version Node.js Version Support build status dependency status License

Note: This pacakge requires Node v8+ for async/await

Install

$ npm install redash-client

Usage

const RedashClient = require('redash-client');
const redash = new RedashClient({
  endPoint: 'https://your-redash.com/',
  apiToken: 'abcde12345',
});
redash
  .queryAndWaitResult({
    query: 'select * from actor',
    data_source_id: 1,
  })
  .then(resp => {
    console.log(resp.query_result);
  });

API

See API document

Supported REST API

Methods for other REST API are not implemented yet. Help!

Utility methods

#queryAndWaitResult()

Internally:

  1. postQueryResult()
  2. Polling getJob()
  3. Return getQueryResult()

License

MIT License: Teppei Sato <teppeis@gmail.com>