Nostalgic Piano Music

    This package has been deprecated

    Author message:

    AWS now has tools to do most of what this was originally designed to do

    aws_athena_cli

    1.0.6 • Public • Published

    AWS Nodejs Athena Command Line Interface

    Install with:

    npm install aws_athena_cli
    

    Note

    I began this little project because at the time Amazon's awsome CLI tool did not extend to Athena. That has since changed. This tool still has some features that CLI does not have (inline substition, reading from file and CL. etc). That said you may want to consider using the AWS CLI for Athena CLI access.

    Usage Example

    AWS credentials are not required and may be provided via ~/.aws/config and ~/.aws/credentials files or via enviromental variables or vi AWS IAM permissions, etc.

    The default output is JSON. This works well for SQL like statements list SELELCT but not for results from ATHENA only statements like 'MSCK REPAIR TABLE action'. To see proper results from those or any statement use the "--raw" output.

    #!/bin/bash 
    node <path/to/install>/aws_athena_cli.js \
    --aws_access_key='awskeyhere' \
    --aws_secret_key='awssecretkeyhere' \
    --aws_region='us-east-2' \
    --aws_s3_tmp='s3://athen_s3_scratch_bucket_must_be_in_same_region_as_above/' \
    --substitutions='_KEY1_=value1,_KEY2_=value2' \
    --query='SELECT somecolum FROM someschema.sometable;' \
    --file='a_file_with_queries.sql'

    API

    Athena Command Line Interface

    Can run multiple queries from command line or from a file. The command line queries are run first. The files queries are then run. Queries are run asyncronously and in order. All schema names must be given in the queries.

    The comma seperated KEY=value pairs will cause any instances of the KEY in queries to be replaced by the values. This command is optional.

    node <path/to/install>/aws_athena_cli.js help

    Will display the following full explaiination of all the command line options:

    Options:
      --aws_access_key, -a  AWS access key.                                 [string]
      --file, -f            A file/path/name. File contains one or more Athena SQL
                            statement.                                      [string]
      --query, -q           One or more Athena SQL queries.                 [string]
      --aws_region, -r      AWS region.                                     [string]
      --aws_secret_key, -s  AWS secret key.                                 [string]
      --aws_s3_tmp, -t      AWS Athena scratch bucket, must be in same region as the
                            Athena schemas.                      [string] [required]
      --substitutions, -u   key1=value1 key2=value2 will cause any instances of key1
                            to be replaced with value1 and so on             [array]
      --raw, -w             Output is in raw format, default is in JSON format
                                                                           [boolean]
      --help                Show help                                      [boolean]

    Install

    npm i aws_athena_cli

    DownloadsWeekly Downloads

    13

    Version

    1.0.6

    License

    none

    Last publish

    Collaborators

    • seandmurray