Skip to content

Commit c8e7b93

Browse files
committed
fix handling
1 parent 2dd79a5 commit c8e7b93

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ export class SnowflakeDriver extends BaseDriver implements DriverInterface {
753753
// Storage integration export flow takes precedence over direct auth if it is defined
754754
if (conf.integrationName) {
755755
optionsToExport.STORAGE_INTEGRATION = conf.integrationName;
756-
} else {
756+
} else if (conf.keyId && conf.secretKey) {
757757
optionsToExport.CREDENTIALS = `(AWS_KEY_ID = '${conf.keyId}' AWS_SECRET_KEY = '${conf.secretKey}')`;
758758
}
759759
} else if (bucketType === 'gcs') {
@@ -793,14 +793,18 @@ export class SnowflakeDriver extends BaseDriver implements DriverInterface {
793793
const { bucketName, path } = this.parseBucketUrl(this.config.exportBucket!.bucketName);
794794
const exportPrefix = path ? `${path}/${tableName}` : tableName;
795795

796+
const s3Config: any = { region };
797+
if (keyId && secretKey) {
798+
// If access key and secret are provided, use them as credentials
799+
// Otherwise, let the SDK use the default credential chain (IRSA, instance profile, etc.)
800+
s3Config.credentials = {
801+
accessKeyId: keyId,
802+
secretAccessKey: secretKey,
803+
};
804+
}
805+
796806
return this.extractUnloadedFilesFromS3(
797-
{
798-
credentials: {
799-
accessKeyId: keyId,
800-
secretAccessKey: secretKey,
801-
},
802-
region,
803-
},
807+
s3Config,
804808
bucketName,
805809
exportPrefix,
806810
);

0 commit comments

Comments
 (0)