Skip to content

Commit

Permalink
Merge 3cd5f19 into 1a518c0
Browse files Browse the repository at this point in the history
  • Loading branch information
talkncloud committed Apr 2, 2021
2 parents 1a518c0 + 3cd5f19 commit 6bd9ac7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -121,6 +121,7 @@ const aws = require("aws-sdk");
const athenaExpressConfig = {
aws, /* required */
s3: "STRING_VALUE", /* optional format 's3://bucketname'*/
catalog: "STRING_VALUE", /* optional - data source */
db: "STRING_VALUE", /* optional */
workgroup: "STRING_VALUE", /* optional */
formatJson: BOOLEAN, /* optional default=true */
Expand All @@ -141,6 +142,7 @@ const athenaExpress = new AthenaExpress(athenaExpressConfig);
| Parameter | Format | Default Value | Description |
| ------------- | ------------- | ------------- | ------------- |
| s3 | string | `athena-express` creates a new bucket for you | The location in Amazon S3 where your query results are stored, such as `s3://path/to/query/bucket/`. <br /> `athena-express` will create a new bucket for you if you don't provide a value for this param but sometimes that could cause an issue if you had recently deleted a bucket with the same name. (something to do with cache). When that happens, just specify you own bucket name. Alternatively you can also use `workgroup`. |
| catalog | string | Athena data source / catalog, required for federated connectors |
| db | string | `default` | Athena database name that the SQL queries should be executed in. When a `db` name is specified in the config, you can execute SQL queries without needing to explicitly mention DB name. e.g. <br />` athenaExpress.query("SELECT * FROM movies LIMIT 3")` <br /> as opposed to <br />` athenaExpress.query({sql: "SELECT * FROM movies LIMIT 3", db: "moviedb"});` |
| workgroup | string | `primary` | The name of the workgroup in which the query is being started. <br /> Note: athena-express cannot create workgroups (as it includes a lot of configuration) so you will need to create one beforehand IFF you intend to use a non default workgroup. Learn More here. [Setting up Workgroups](https://docs.aws.amazon.com/athena/latest/ug/user-created-workgroups.html) |
|formatJson | boolean | `true` | Override as false if you rather get the raw unformatted output from S3. |
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Expand Up @@ -4,6 +4,7 @@ declare module 'athena-express' {
aws: typeof aws;
s3: string;
getStats: boolean;
catalog: string,
db: string,
workgroup: string,
formatJson: boolean,
Expand Down
1 change: 1 addition & 0 deletions lib/athenaExpress.js
Expand Up @@ -22,6 +22,7 @@ module.exports = class AthenaExpress {
.substring(0, 10)
.toLowerCase()}-${new Date().getFullYear()}`,
encryption: init.encryption,
catalog: init.catalog,
db: init.db || "default",
workgroup: init.workgroup || "primary",
retry: Number(init.retry) || 200,
Expand Down
1 change: 1 addition & 0 deletions lib/helpers.js
Expand Up @@ -15,6 +15,7 @@ function startQueryExecution(query, config) {
OutputLocation: config.s3Bucket,
},
QueryExecutionContext: {
Catalog: config.catalog,
Database: query.db || config.db,
},
};
Expand Down

0 comments on commit 6bd9ac7

Please sign in to comment.