-
Notifications
You must be signed in to change notification settings - Fork 822
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
@key on model search for multiple values for the fields #3331
Comments
@dantasfiles - thank you for your response. 1) Multiple Queries. I'm really trying to avoid this, because I have a table that will have a lot of items in it and pagination. I have 8 different statuses here in play and so just managing all that gets a little complicated quickly. Not to mention really inefficient. 2) Scan/List. I'm currently doing this but the data coming back is not sorted by what I want ("updatedAt"). This is one of the reasons why I have a named @key with a sort field on it. 3) Batch operations. Batch operations just seem so painful. I wasn't aware of them until now, so thank you. I scanned the links you sent and I don't see a great pathway to write a simple get for these, I will continue to look into them, but this seems less than ideal. But that still has me scratching my head on this one ... why not just support multiple here? (via the normal and, or, eq ... etc.) |
There's another way--I remembered a post I read:
The queryName of every item is always The gives you
It's not what you want, but it's more efficient than a scan if you can figure something clever out with the |
Yeah during my reply to you I was investigating the primary index. I got stopped by two things:
Resulted in this:
So I've run into this before ... and I have to say createdAt and updatedAt should be automatically available and we shouldn't have to declare them in the schema. To get around this, I have to do:
So now, I'm required to supply an updatedAt from the client .... which is just wrong. Even with that ... I changed the primary index and got this error:
So I'm guessing I have to manually delete the index and then allow this update to happen to re-create. This is really frustrating from an app dev perspective. ---- Edit ---- I'm stuck now .... I can't get Any help? |
@mikeparisstuff - I wonder if you might be able to weigh in on this. Basically at this point I have a model looking like this:
And then I try and change the primary index to:
And I can't do an Also if you might be able to provide any insight into the fact that my original problem (see description). Thank you! ---- Edit ----- So this is just beyond frustrating .... I'm trying to resolve this by removing the table and replacing it via these instructions: Resolve CloudFormation and I'm in a quagmire of editor hell. It makes me really start thinking: "how is amplify-cli with DynamoDB even close to be ready for prime time" .... All I'm trying to do is add a default sort to the primary index and the stack just fails miserably. I can see a justification for not supporting this w/o manual intervention. But if I remove the index in question, can someone please explain to me how an ---- Edit #2 ---- I took a backup of the table and was able to manually restore it (because the table was deleted and recreated I couldn't do this automatically). I only had a few records so this was painful, but not horrible. And after all that ... the items are not indexed by |
OK so I just realized that I was not actually deleting the primary index (I don't think there's really a way to do this??? - not sure why that's not supported by DynamoDB???). Just trying to add a simple sort key spawned a few other tickets: |
You are correct that once a DynamoDB table has been created, the primary key cannot be changed. I'm going to close this issue and continue to follow up in #3347 because it seems like they are both converging to the same underlying problem. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Which Category is your question related to?
graphql / DynamoDB
Amplify CLI Version
4.13.1
What AWS Services are you utilizing?
AppSync / DynamoDB
Provide additional details e.g. code snippets
This will generate something like this:
This is great, but what if I want to search for multiple PublicationStatus values? Right now I only see a way to search for a single status. Is there another way of doing this without? (w/o multiple queries)
The text was updated successfully, but these errors were encountered: