-
Notifications
You must be signed in to change notification settings - Fork 249
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
Custom primary key support #1426
Comments
Use case for using Custom PK. We have a BLE device that has its own identifier which cannot be changed for security reasons. This along with some other information is sent to a Lambda function which then searches for the device "key" in DynamoDB and updates via AppSync. I did not want to have to send the generated "ID" as this means id have to then store it on flash (Limited space) and add it to the network packet which uses 3g/4g increasing our overhead. I believe AppSync requires the primary key field for updates hence me needing a custom one. This is also how the subscriptions for updates work by key. I am not sure if I could have done the same via ID, Correct me if I am wrong. Thinking on it I could have searched the DB for the ID by finding the key field and then updated... It just felt better to make a custom primary key. |
We have been confronted with almost the exact same use case as @tr-asimpson . We are working with BLE devices and have natural keys currently defined in DynamoDB. We really want to use AppSync, but if we do, we'll have to apply costly workarounds, and will impact our customer experience. Is it possible to share where this enhancement is on the roadmap or an ETA so that we can appropriately plan? Thanks! |
+1 |
Even we are facing this issue. It would be helpful if this is implemented soon. |
Hi there I can't get a unique record from dynamodb through AppSync using: Also, since I can't use two owner type auth rules (aws-amplify/amplify-swift#1590, aws-amplify/amplify-cli#10110) EDIT: Nevermind, I realized I can just replace ModelQueries.get with a GraphQL query... |
Hey there, what's the ETA on resolving this issue? It looks like a lot of work has already been completed and is merged. We just started prototyping a flutter mobile app client for our existing amplify web application that uses custom PKs and ran into this issue. Currently we're considering two options:
|
Hello @hanna-becker sorry for the delayed response! You are right! This feature is almost ready (library support has been released with version 0.6.6). We are currently working on some final tunings cross Amplify platforms. We expect this feature to be live very soon, thank you for your patience! |
Nice! We're very excited about this. |
Hi do you have any updates about this? Is it already possible to set a custom primary key with amplify? |
Hi @hanna-becker @8maxxam8 with the release of For an existing project, you may need to manually flip a feature flag in order to enable custom primary key functionality with Amplify CLI and codegen. Set {
"features": {
"graphqltransformer": {
"respectPrimaryKeyAttributesOnConnectionField": true,
}
}
} Then run In addition, currently custom primary key feature is only available for DataStore plugin, model generated with a custom primary key will not work with API plugin GraphQL helper. |
@HuiSF, to clarify where CPK support is available, would it be possible to have something like
|
Hi @vgribok thanks for asking the clarification. Current state:
For the API plugin the GraphQL helper APIs need to be update to support |
Just noting PR merged for GraphQL API support here #2606, should go out in next dev preview version. |
GraphQL API model helper support for custom primary key was just released in dev preview with amplify_api 1.0.0-next.6. There are some examples of usage on https://docs.amplify.aws/lib/graphqlapi/query-data/q/platform/flutter/#query-item. We will leave this issue open until there is a stable release for this. |
This issue has been addressed in v1.0.0 of Amplify Flutter, which is now stable. See the comment above for a link to the docs. This release also includes web and desktop support for Auth, API, Analytics, and Storage. You can see the list of new features and bug fixes in the release notes, and see more details on how to migrate in the upgrade guide. |
Description
This is to track support of custom primary keys in model gen and model mutations.
Current state of custom primary key support
Categories
Steps to Reproduce
No response
Screenshots
No response
Platforms
Environment
Dependencies
Device
N/A
OS
N/A
CLI Version
N/A
Additional Context
No response
The text was updated successfully, but these errors were encountered: