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

feat(redshift): Add support for distStyle, distKey, sortStyle and sortKey to Table #17135

Merged
merged 6 commits into from
Nov 11, 2021
Merged

feat(redshift): Add support for distStyle, distKey, sortStyle and sortKey to Table #17135

merged 6 commits into from
Nov 11, 2021

Conversation

ayush987goyal
Copy link
Contributor

@ayush987goyal ayush987goyal commented Oct 24, 2021

feat(redshift): Add support for distStyle, distKey, sortStyle and sortKey to Table

closes #17125

Ref:

  1. https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html
  2. https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Oct 24, 2021

@github-actions github-actions bot added the @aws-cdk/aws-redshift Related to Amazon Redshift label Oct 24, 2021
@ayush987goyal ayush987goyal marked this pull request as draft October 25, 2021 12:48
@njlynch njlynch added effort/medium Medium work item – several days of effort p1 labels Oct 28, 2021
@ayush987goyal ayush987goyal changed the title feat(redshift): Add support for distStyle and distKey to Table feat(redshift): Add support for distStyle, distKey, sortStyle and sortKey to Table Oct 31, 2021
@ayush987goyal ayush987goyal marked this pull request as ready for review October 31, 2021 04:38
@ayush987goyal
Copy link
Contributor Author

@njlynch Could you please help me address this error in the build?

monocdk: error JSII3000: Exported APIs cannot use un-exported type "monocdk.TableDistStyle"
monocdk: error JSII3000: Exported APIs cannot use un-exported type "monocdk.TableSortStyle"

The following seems to be related to aws/jsii#1818 and aws/jsii#1830

And I need to declare those enums in that particular folder only for the reason specified in the comment above.

packages/@aws-cdk/aws-redshift/lib/index.ts Outdated Show resolved Hide resolved
}

const oldTableColumns = oldResourceProperties.tableColumns;
if (!oldTableColumns.every(oldColumn => tableColumns.some(column => column.name === oldColumn.name && column.dataType === oldColumn.dataType))) {
return createTable(tableNamePrefix, tableNameSuffix, tableColumns, clusterProps);
return createTable(tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you educate me? What happens in this case? We have a table already with a name (e.g., MyTable) and we add a column. Then we execute a CREATE TABLE MyTable... statement with a slightly different set of columns. Wouldn't that fail due to the table name already existing? I'm wondering the same about all of the other return createTable calls further down this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes the create table call would fail here in case the table needs replacing. The customer would then have a choice of manually dropping the table and/or updating the columns to avoid replacement.

packages/@aws-cdk/aws-redshift/lib/table.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-redshift/lib/table.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-redshift/lib/table.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-redshift/lib/table.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-redshift/lib/table.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed njlynch’s stale review November 11, 2021 15:56

Pull request has been modified.

Comment on lines +125 to +124
switch (newSortStyle) {
case TableSortStyle.INTERLEAVED:
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome; can you add that as a comment here, just so its clear in-source?

@mergify mergify bot dismissed njlynch’s stale review November 11, 2021 16:39

Pull request has been modified.

Copy link
Contributor

@njlynch njlynch left a comment

Choose a reason for hiding this comment

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

👍

@mergify
Copy link
Contributor

mergify bot commented Nov 11, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: e153971
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit a137cd1 into aws:master Nov 11, 2021
@mergify
Copy link
Contributor

mergify bot commented Nov 11, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@ayush987goyal ayush987goyal deleted the pr/redshift-table-extras branch November 12, 2021 03:22
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
…tKey to Table (aws#17135)

feat(redshift): Add support for distStyle, distKey, sortStyle and sortKey to Table

closes aws#17125 

Ref:
1. https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html
2. https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-redshift Related to Amazon Redshift effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(redshift): support configurable SORTKEY and DISTKEY in tables
3 participants