aws-athena-node-client-testing
[![Build Status](https://travis-ci.org/avegao/aws-athena-node-client.svg?branch=master)](https://travis-ci.org/avegao/aws-athena-node-client) [![Maintainability](https://api.codeclimate.com/v1/badges/5eb885bb8f1eaf644813/maintainability)](https://codeclim
Last updated a year ago by alrico88 .
MIT · Original npm · Tarball · package.json
$ cnpm install aws-athena-node-client-testing 
SYNC missed versions from official npm registry.

AWS Athena Client for NodeJS

Build Status Maintainability Test Coverage Quality Gate Status

Installation

Using NPM:

npm install aws-athena-node-client

Using yarn:

yarn add aws-athena-node-client

Use

Create client

const athenaClient = new AthenaClient({
    awsConfig: {
        accessKeyId: 'DASCDAS82941',
        apiVersion: '2017-05-18',
        region: 'eu-west-1',
        secretAccessKey: 'CJDADDHDASIUOHADS/3123DASE12',
    },
    bucketUri: 's3://athena-query-results-eu-west-1/',
    database: 'default',
    waitTime: 0.5,
    workGroup: 'my-work-group',
});

Run query

Javascript

const query = `SELECT 1`;

athenaClient.executeQuery(query)
    .then((results) => {
      console.log(results);
    })
    .catch((error) => {
      console.error(error);
    });

Typescript

const query = `SELECT 1`;

try {
    const results = await athenaClient.executeQuery<T>(query);
    console.log(results);
} catch (error) {
    console.error(error);
}

Run query and get S3 URL with results

const query = `SELECT 1`;

athenaClient.executeQueryAndGetS3Url(query)
    .then((s3Url) => {
      console.log(s3Url); // Print s3://S3_BUCKET_NAME/QUERY_ID.csv
    })
    .catch((error) => {
      console.error(error);
    });

Typescript

const query = `SELECT 1`;

try {
    const results = await athenaClient.executeQueryAndGetS3Url(query);
    console.log(results);  // Print s3://S3_BUCKET_NAME/QUERY_ID.csv
} catch (error) {
    console.error(error);
}

Cancel query

const query = `SELECT 1`;

athenaClient.executeQuery(query, parameters, 'hdaiuh33r8uyjdkas')
    .then((results) => {
      console.log(results);
    })
    .catch((error) => {
      if (!(error instanceof QueryCanceledException)) {
        console.error(error);
      }
    });

Typescript

const query = `SELECT 1`;

try {
    const results = await athenaClient.executeQuery<T>(query, parameters, 'hdaiuh33r8uyjdkas');
    console.log(results);
} catch (error) {
    if (!(error instanceof QueryCanceledException)) {
        console.error(error);
    }
}

You must run this code in a distinct thread than the query execution thread.

athenaClient.cancelQuery('hdaiuh33r8uyjdkas')
    .then((results) => {
      // continue
    })
    .catch((error) => {
      console.error(error);
    });

Typescript

try {
    await athenaClient.cancelQuery('hdaiuh33r8uyjdkas');
} catch (error) {
    console.error(error);
}

Current Tags

  • 1.1.1                                ...           latest (a year ago)

10 Versions

  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (14)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |