Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCK-8703: hckFetch #50

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion esbuild.package.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ esbuild
outdir: RELEASE_FOLDER_PATH,
minify: true,
logLevel: 'info',
external: ['lodash'],
external: ['lodash', 'electron'],
plugins: [
clean({
patterns: [DEFAULT_RELEASE_FOLDER_PATH],
Expand Down
28 changes: 26 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@aws-sdk/client-redshift": "3.679.0",
"@aws-sdk/client-redshift-data": "3.679.0",
"@aws-sdk/client-redshift-serverless": "3.679.0",
"@hackolade/fetch": "1.1.0",
"lodash": "4.17.21"
},
"lint-staged": {
Expand Down Expand Up @@ -103,4 +104,4 @@
"prettier": "3.2.5",
"simple-git-hooks": "2.11.1"
}
}
}
18 changes: 15 additions & 3 deletions reverse_engineering/helpers/redshiftHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const redshiftClient = require('@aws-sdk/client-redshift');
const redshiftData = require('@aws-sdk/client-redshift-data');
const redshiftLess = require('@aws-sdk/client-redshift-serverless');
const ddlViewCreationHelper = require('./ddlViewCreationHelper');
const { hckFetchAwsSdkHttpHandler } = require('@hackolade/fetch');

const noConnectionError = { message: 'Connection error' };

Expand Down Expand Up @@ -36,15 +37,26 @@ const getParamsForConnect = connectionInfo => {

const connect = async (connectionInfo, logger) => {
helperLogger = logger;
const { clusterIdentifier, databaseName, workgroupName, instanceType = 'Cluster' } = connectionInfo;
const {
clusterIdentifier,
databaseName,
workgroupName,
instanceType = 'Cluster',
queryRequestTimeout,
} = connectionInfo;
const params = getParamsForConnect(connectionInfo);
const redshiftDataInstance = new redshiftData.RedshiftData({ apiVersion: '2019-12-20', ...params });
const requestHandler = hckFetchAwsSdkHttpHandler({ requestTimeout: queryRequestTimeout });
const redshiftDataInstance = new redshiftData.RedshiftData({
apiVersion: '2019-12-20',
...params,
requestHandler,
});
if (instanceType === 'Cluster') {
redshift = await setCluster(params, clusterIdentifier, databaseName);
} else if (instanceType === 'ServerLess') {
redshift = await setServerLess(params, workgroupName, databaseName);
}
redshift = { ...redshift, redshiftDataInstance, instanceType };
redshift = { ...redshift, redshiftDataInstance, instanceType, requestHandler };
};

const setCluster = async (params, clusterIdentifier, databaseName) => {
Expand Down