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

Feature: add RedShift #297

Closed
wants to merge 13 commits into from
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"toad-scheduler": "^2.2.0",
"tslib": "^2.3.0",
"tslog": "^3.3.3",
"uuid": "^9.0.0"
"uuid": "^9.0.0",
"@aws-sdk/client-redshift-data": "^3.405.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may suggest you put the @aws-sdk/client-redshift-data package in the extension-driver-redshift package, then the @aws-sdk/client-redshift-data package will only installed when user add the extension-driver-redshift

You could refer to the package.json of extension-driver-clubhouse and extension-driver-snowflake packages.

},
"devDependencies": {
"@faker-js/faker": "^6.3.1",
Expand Down
18 changes: 18 additions & 0 deletions packages/extension-driver-redshift/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
53 changes: 53 additions & 0 deletions packages/extension-driver-redshift/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# extension-driver-redshift

[@aws-sdk/client-redshift-data](https://www.npmjs.com/package/@aws-sdk/client-redshift-data) driver for VulcanSQL.

reference: https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-redshift-data

## Install

1. Install package

```bash
npm i @vulcan-sql/extension-driver-redshift
```

2. Update `vulcan.yaml`, enable the extension.

```yaml
extensions:
redshift: '@vulcan-sql/extension-driver-redshift'
```

3. Create a new profile in `profiles.yaml` or in your profiles' paths.

```yaml
- name: redshift # profile name
type: redshift
allow: "*"
connection:
# please see the type definition of RedshiftDataClientConfig
# https://github.com/aws/aws-sdk-js-v3/blob/29056f4ca545f7e5cf951b915bb52178305fc305/clients/client-redshift-data/src/RedshiftDataClient.ts#L253C18-L253C42
credentials:
accessKeyId: <REDSHIFT_ACCESS_KEY_ID>
secretAccessKey: <REDSHIFT_SECRET_ACCESS_KEY>
# please see the type definition of ExecuteStatementCommandInput(omit Sql and Parameters)
# https://github.com/aws/aws-sdk-js-v3/blob/29056f4ca545f7e5cf951b915bb52178305fc305/clients/client-redshift-data/src/models/models_0.ts#L805C18-L805C39
Database: <REDSHIFT_DATABASE>
WorkgroupName: <REDSHIFT_WORKGROUP_NAME>
```

## Testing

```bash
nx test extension-driver-redshift
```

This library was generated with [Nx](https://nx.dev).

To run test, the following environment variables are required:

- REDSHIFT_ACCESS_KEY_ID
- REDSHIFT_SECRET_ACCESS_KEY
- REDSHIFT_DATABASE
- REDSHIFT_WORKGROUP_NAME
14 changes: 14 additions & 0 deletions packages/extension-driver-redshift/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
displayName: 'extension-driver-redshift',
preset: '../../jest.preset.ts',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
transform: {
'^.+\\.[tj]s$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/extension-driver-redshift',
};
Loading