Repository navigation
v2.0.0
- Upgraded to AWS SDK v3
- Support for AWS Athena cache
- ESM support
- Use in AWS Lambda supported
Breaking changes
- Dropped support for nodejs < v18
Upgrade from v1 to v2
- Client class renamed to
AthenaNodeClientto prevent issues with@aws-sdk/client-athenaclasses naming. - Now you must instance
AthenaClientfrom@aws-sdk/client-athenapackage. This is to optimize support for AWS Lambda
functions (@aws-sdk/*packages are included in AWS Lambda runtime), use the most updated version of this
package in your project and you can use more custom configurations in the AWS SDK client, like roles.
Before
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',
});After
import {AthenaClient} from '@aws-sdk/client-athena';
const athena = new AthenaClient({});
const athenaNodeClient = new AthenaNodeClient(athena, {
bucketUri: 's3://athena-query-results-eu-west-1/',
database: 'default',
waitTime: 0.5,
workGroup: 'my-work-group',
});- If you use methods
executeQueryAndGetS3KeyexecuteQueryAndGetDownloadSignedUrlnow you must create your S3 client
before. The reason is the same with the Athena client.
Before
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',
});After
import {AthenaClient} from '@aws-sdk/client-athena';
import {S3} from '@aws-sdk/client-s3';
const athena = new AthenaClient({});
const s3 = new S3({
useDualstackEndpoint: true, // recommended to support IPv6
});
const athenaNodeClient = new AthenaNodeClient(athena, {
bucketUri: 's3://athena-query-results-eu-west-1/',
database: 'default',
waitTime: 0.5,
workGroup: 'my-work-group',
s3Client: s3,
});-
Method
executeQueryAndGetS3Urlis renamed toexecuteQueryAndGetS3Keyand now returns and object with the S3 bucket
and key of the object generated by Athena instead of returns an S3 schema url. If you want a direct URL to download the
results, you must useexecuteQueryAndGetDownloadSignedUrlmethod. -
All query related method, now have 2 parameters, sql and query config. The query parameters and query id, must be
inside this second parameter:
Before
const results = await athenaClient.executeQuery<T>(query, parameters, queryId);After
const results = await athenaNodeClient.executeQuery<T>(query, {
parameters: {
name: 'John',
surname: 'Doe',
},
id: 'abcd',
cacheInMinutes: 60,
});Full Changelog: v1.4.3...v2.0.0