-
Notifications
You must be signed in to change notification settings - Fork 117
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
Fix (datastore) quote sql commands #712
Conversation
Datastore SQL commands fail if your model has SQLite reserved words in them. This quotes table and column names to avoid that Resolves: aws-amplify#707
Let me do that in a further commit |
@jamesonwilliams I replaced quote in SqlKeyword with Wrap.inBackticks. On the subject of having a test case for this, what exactly are we targeting not covered by existing cases? Additionally, I am still finding my way through the code so a pointer to a similar case will be helpful. |
The existing tests are passing, so that's a great sign. We don't currently have any tests that check what you documented in #707. In other words: what happens when a model includes a field that is a SQL reserved word? The instrumentation tests for the SQL storage layer are in The test we want to run is:
There are two strategies to gain this coverage.
Ping me on Discord if you want to chat more about this! |
aws-datastore/src/test/java/com/amplifyframework/datastore/storage/sqlite/SqlCommandTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive PR! Thank you for your contribution. I had a few nit-picky comments, but it looks ready to go once you address it.
...idTest/java/com/amplifyframework/datastore/storage/sqlite/SQLiteStorageReservedWordTest.java
Outdated
Show resolved
Hide resolved
…ore/storage/sqlite/SQLiteStorageReservedWordTest.java Co-authored-by: Raphael Kim <52714340+raphkim@users.noreply.github.com>
LGTM, thanks for the contribution @saltonmassally. You get a "Contributors" badge on Discord, now, as well as cool green lettering for your name. :-D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Issue #, if available:
Datastore SQL commands fail if your model has SQLite reserved words in them. see #707
Description of changes:
This quotes table and column names to avoid that.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.