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

Fixed idempotency issue by first checking if table does not exist #1035

Conversation

alantao912
Copy link
Contributor

Fixed idempotency issue by first checking if table does not exist

Github Issue Number Here: <#1033>
What user problem are we solving?
AppStack.ts does not start because trainspace table already exists.

What solution does this PR provide?
Checks if the table does not already exist before creating it again.

Testing Methodology
Typed dlp-cli serverless start and it worked.

Any other considerations

Issue may have been fixed by something else.

@alantao912 alantao912 requested a review from a team as a code owner October 23, 2023 00:49
@alantao912 alantao912 linked an issue Oct 23, 2023 that may be closed by this pull request
resultCsvUri: "string",
modelPtUri: "string",
onnxUri: "string",
confusionMatrixUri: "string",
Copy link
Member

Choose a reason for hiding this comment

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

will this code work for if I want to update fields of a dynamo table?

Copy link
Member

@karkir0003 karkir0003 left a comment

Choose a reason for hiding this comment

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

added a question

export async function table_exists(table_name: string) : Promise<boolean> {
const tableNames: string[] = await get_all_tablenames();
return tableNames.indexOf(table_name) !== -1;
}
Copy link
Member

Choose a reason for hiding this comment

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

Minor: can you please run Prettier for all changed files? There are some aesthetic issues; for example, each file should end with a blank line.

We'll need to update our checks to also check /serverless in addition to /frontend

@karkir0003
Copy link
Member

@alantao912 can you ask in sst discord best practice for checking if a table exists before creating a new one. ask if sst handles that check sort of under the hood

@alantao912
Copy link
Contributor Author

@alantao912 can you ask in sst discord best practice for checking if a table exists before creating a new one. ask if sst handles that check sort of under the hood

image
I already tried </3 :(

@karkir0003
Copy link
Member

@alantao912 can you ask in sst discord best practice for checking if a table exists before creating a new one. ask if sst handles that check sort of under the hood

image I already tried </3 :(

is there a way we can tag someone who maintains SST in this thread @alantao912

Comment on lines +49 to +52
globalIndexes: {
"TrainspaceIndex": { partitionKey: "trainspaceId", sortKey: "timestamp"},
"UserIndex": {partitionKey: "userId"}
},
Copy link
Member

@karkir0003 karkir0003 Oct 25, 2023

Choose a reason for hiding this comment

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

What if I want to update a GSI or User index. Can we update the PR to be resilient for those cases? @alantao912

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think the current approach is correct. I'm looking into other solutions.

Copy link
Member

@karkir0003 karkir0003 left a comment

Choose a reason for hiding this comment

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

added a quick comment @alantao912

Copy link

sonarcloud bot commented Nov 19, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@karkir0003
Copy link
Member

@alantao912 status on this?

@karkir0003 karkir0003 closed this Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: Create Table command in AppStack.ts not idempotent.
3 participants