amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

How to specify sortkey for dynamodb

Open vjindalaurea opened this issue 7 years ago • 7 comments

How can specify sort key e.g.

type Post @model { id: ID! # id: ID! is a required attribute. title: String! tags: [String!]! }

How can i specify title as sort key ?

vjindalaurea avatar Mar 27 '19 06:03 vjindalaurea

@vjindalaurea We don't have that support yet, but we have an RFC for this feature which we're currently working on this feature based off this RFC - #1062

kaustavghosh06 avatar Mar 29 '19 19:03 kaustavghosh06

Is there a known workaround? Also, in the above example @model, is the id field mapped to a partition key or primary key?

kwhitejr avatar Apr 16 '19 02:04 kwhitejr

You cannot set the sort key on the table but you can create indexes with sort keys set using @connection. As mentioned above we are working on improving the indexing experience with DynamoDB and that will be updated in the RFC.

mikeparisstuff avatar Apr 19 '19 20:04 mikeparisstuff

is there an idea when you will support sortkeys?

marcschroeter avatar Apr 19 '19 21:04 marcschroeter

There is not set release date but updates will be put in this RFC #1062.

mikeparisstuff avatar Apr 19 '19 22:04 mikeparisstuff

We launched support for custom indexes today. You can find docs for the same out here - https://aws-amplify.github.io/docs/cli/graphql#key Please let us know if you're still not able to solve your problem through this solution and we'll re-open this issue for you.

kaustavghosh06 avatar May 30 '19 05:05 kaustavghosh06

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 *-help channels for those types of questions.

github-actions[bot] avatar May 26 '21 01:05 github-actions[bot]