aws-amplify / aws-amplify/docs

Can AppSync owner field be used as primary key?

Open
#6,200 0 comments 0 reactions 0 assignees View on GitHub
amplify/data pending-close-if-no-response
Dominant language
MDX
Stars
506
Forks
1.1k
Avg merge
3h 14m
Merged PRs (30d)
1

Description

The [GraphQL Per-user / owner-based data access](https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access) docs state the following:

> Do not set ownerField to your @primaryKey field or id field if no primary key is specified. If you want to query by the ownerField, use an @index on that ownerField to create a secondary index.

I'm seeking clarification around if/when it is appropriate to apply the @primaryKey directive to the owner field. My ultimate goal is to enforce a 1:1 constraint for a given Cognito user and GraphQL model.

Contributor guide

Open the contributing guide

Research direction

Start with the linked GraphQL per-user/owner-based data access documentation, especially the guidance for ownerField, @primaryKey, and @index. Determine whether using the owner field as a primary key is supported for the stated 1:1 Cognito-user constraint, then update the documentation with the applicable clarification and examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.