Add OneToOne relation type
See original GitHub issueIssue Description
apart from OneToMany (by ForeignKey
) and ManyToMany
add also support for OneToOne
relations.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:9 (2 by maintainers)
Top Results From Across the Web
One-to-one relations - typeorm - GitBook
One-to-one is a relation where A contains only one instance of B, and B contains only one instance of A. Let's take for...
Read more >What Is a One-to-One Relationship in a Database?
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 >Video: Create one-to-one relationships
Create a one-to-one relationship steps · Open a table. · In Design View, add a new field, select the Data Type value, and...
Read more >One-to-One Relationship in JPA
One-to-one mappings can be of two types: optional and mandatory. So far, we've seen only mandatory relationships.
Read more >One-to-one relationships
To define a one-to-one relationship, use OneToOneField . What follows are examples of operations that can be performed using the Python API facilities....
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
Thanks, I’ll try and make a PR
So before I saw your reply, I was looking through the source to see if this was something I could hack in and discovered that the
ForeignKey
function hardcodesprimary_key=False
which explains the error above. I monkey patched the field like this:And that allowed things to continue and me to actually run the query. I’m not sure if this is an “expected” failure (given the impending compound pk work) or a sort of bug that would otherwise allow this kind of work around to work, so thought I’d report it. The query produces SQL like this:
resulting in an SQL error:
If I remove
data_reception
(the Postgres Schema) from theAND
condition, the query executes as expected.Is this a new bug with the schema being inappropriately inserted, or a known effect that will be covered by the compound pk work?