Neti Pot Manufacturer

    aws-athena-node-client-testing
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.1 • Public • Published

    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);
    }

    Keywords

    none

    Install

    npm i aws-athena-node-client-testing

    DownloadsWeekly Downloads

    19

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    98.7 kB

    Total Files

    28

    Last publish

    Collaborators

    • alrico88