One to one connections
See original GitHub issueI’m getting the following error when I attempt to compile my schema:
InvalidDirectiveError: Connection is to a single object but the keyName <key-name> was provided which does not reference the default table.
Is it possible to define a one-to-one relationship with a keyName argument?
Which Category is your question related to? GraphQL compile
Amplify CLI Version 4.17.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
One-to-one relationships
In a one-to-one relationship, one record in a table is associated with one and only one record in another table. For example, in...
Read more >What Is a One-to-One Relationship in a Database? - Vertabelo
A one-to-one relationship is a relationship where a record in one table is associated with exactly one record in another table. This type...
Read more >One-to-one (data model) - Wikipedia
In a relational database, a one-to-one relationship exists when one row in a table may be linked with only one row in another...
Read more >One-to-one relationship - Progress Documentation
A one-to-one relationship exists when each row in one table has only one related row in a second table. For example, a business...
Read more >One to one relationship examples in Database | T4Tutorials.com
One-to-One Relationship exists when a single record in the 1st table is having a relationship with only one record in the 2nd table,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @kldeb yes you are correct, you’ll need to store the referralId with the customer. Unfortunately there’s no great workaround to #3275 at this time. You might be able to get the behavior you want by putting a placeholder value for referralId in the customer record if there is no referralId for the customer:
When creating a customer without a referral, you can put a placeholder value in the referralId which means that the referredBy field is going to come back null in queries.
I’m going to close this issue and you can track the progress of optional connections in #3275
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.