@@ -30,9 +30,11 @@ interface AthenaDriverOptions extends AthenaClientConfig {
3030 readOnly ?: boolean
3131 accessKeyId ?: string
3232 secretAccessKey ?: string
33+ sessionToken ?: string
3334 workGroup ?: string
3435 catalog ?: string
3536 schema ?: string
37+ database ?: string
3638 S3OutputLocation ?: string
3739 exportBucket ?: string
3840 pollTimeout ?: number
@@ -103,6 +105,10 @@ export class AthenaDriver extends BaseDriver implements DriverInterface {
103105 config . secretAccessKey ||
104106 getEnv ( 'athenaAwsSecret' , { dataSource } ) ;
105107
108+ const sessionToken =
109+ config . sessionToken ||
110+ getEnv ( 'athenaAwsSessionToken' , { dataSource } ) ;
111+
106112 const { schema, ...restConfig } = config ;
107113
108114 this . schema = schema ||
@@ -112,7 +118,7 @@ export class AthenaDriver extends BaseDriver implements DriverInterface {
112118 this . config = {
113119 ...restConfig ,
114120 credentials : accessKeyId && secretAccessKey
115- ? { accessKeyId, secretAccessKey }
121+ ? { accessKeyId, secretAccessKey, sessionToken }
116122 : undefined ,
117123 region :
118124 config . region ||
@@ -127,6 +133,9 @@ export class AthenaDriver extends BaseDriver implements DriverInterface {
127133 catalog :
128134 config . catalog ||
129135 getEnv ( 'athenaAwsCatalog' , { dataSource } ) ,
136+ database :
137+ config . database ||
138+ getEnv ( 'athenaAwsDatabase' , { dataSource } ) ,
130139 exportBucket :
131140 config . exportBucket ||
132141 getEnv ( 'dbExportBucket' , { dataSource } ) ,
@@ -274,7 +283,10 @@ export class AthenaDriver extends BaseDriver implements DriverInterface {
274283 ResultConfiguration : {
275284 OutputLocation : this . config . S3OutputLocation
276285 } ,
277- ...( this . config . catalog != null ? { QueryExecutionContext : { Catalog : this . config . catalog } } : { } )
286+ QueryExecutionContext : {
287+ Catalog : this . config . catalog ,
288+ Database : this . config . database
289+ }
278290 } ;
279291 const { QueryExecutionId } = await this . athena . startQueryExecution ( request ) ;
280292 return { QueryExecutionId : checkNonNullable ( 'StartQueryExecution' , QueryExecutionId ) } ;
0 commit comments