Skip to content

Commit

Permalink
Merge pull request #32 from doublesharp/patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
KoteiIto committed Apr 28, 2018
2 parents 65b07cf + 0897024 commit 9bf9f3b
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ client.execute('SELECT 1', function(err, data) {
client.execute('SELECT 1').toPromise()
.then(function(data) {
console.log(data)
}).catch(function(err) {
})
.catch(function(err) {
console.error(err)
})
```
Expand All @@ -64,31 +65,31 @@ stream.on('error', function(e) {

# API
### athena = require("athena-client")
This module exposes the `createClient` and `setConcurrentExecMax` method, which execute query to AWS Athena
This module exposes the `createClient` and `setConcurrentExecMax` method, which execute query to AWS Athena.

### client = athena.createClient([_clientConfig_], [_awsConfig_])
Returns a client instance attached to the account specified by the given clientConfig and awsConfig.
Returns a client instance attached to the account specified by the given `clientConfig` and `awsConfig`.

### athena.setConcurrentExecMax([_concurrentExecMax_])
Set the number of cuncurrent execution of query max. It should be set `smaller than AWS Service limit`(default is 5)
Set the number of cuncurrent execution of query max. It should be set `smaller than AWS Service limit` (default is 5).

#### `clientConfig` object properties
| Property | Default | Description |
|-----------|-----------|-------------|
| bucketUri | __Required__ | URI of S3 bucket for saving a query results file(*.csv) and a metadata file (*.csv.metadata) |
| bucketUri | __Required__ | URI of S3 bucket for saving a query results file (*.csv) and a metadata file (*.csv.metadata) |
| pollingInterval | 1000 | Interval of polling sql results (ms) |
| queryTimeout | 0 | Timeout of query execution. `0` is no timeout |

#### `awsConfig` object properties
| Property | Default | Description |
|-----------|-----------|-------------|
| region | __Required__ | Your Athena and S3 region |
| accessKeyId | undifined | Your IAM accessKeyId. This is optional |
| secretAccessKey | undifined | Your IAM secretAccessKey. This is optional |
| accessKeyId | undefined | Your IAM `accessKeyId`, optional |
| secretAccessKey | undefined | Your IAM `secretAccessKey`, optional |

### client.execute([_query_], [_callback_])
It will return the following result.
If you want to know more about params of `queryExecution`, please refer to the aws-sdk [document](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Athena.html#getQueryExecution-property)
If you want to know more about params of `queryExecution`, please refer to the `aws-sdk` [document](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Athena.html#getQueryExecution-property)

```json
{
Expand All @@ -115,10 +116,10 @@ If you want to know more about params of `queryExecution`, please refer to the a
```

### client.execute([_query_]).toPromise()
It will return promise object to get result.
Returns a `Promise` that resolves the result of your query.

### client.execute([_query_]).toStream()
It will return stream object to get result. If your query results are very `large`, we recommend using this stream.
Returns a `Stream` to buffer the results of your query. This method is recommended for **large** result sets.

```js
// Get record one by one
Expand All @@ -137,4 +138,4 @@ stream.on('end', function() {
stream.on('error', function(e) {
console.error(e)
})
```
```

0 comments on commit 9bf9f3b

Please sign in to comment.