Re: [Sqlalchemy-tickets] [sqlalchemy] #2725: The sense foreign_keys parameter to orm.relationship i
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-05-10 05:07:27
|
#2725: The sense foreign_keys parameter to orm.relationship is unclear
-----------------------------------+----------------------------------
Reporter: amluto | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: documentation | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* severity: no triage selected yet => minor - half an hour
* status_field: needs questions answered => completed/closed
Comment:
Replying to [comment:2 amluto]:
> Hmm. That particular example is actually not bad, although I got thrown
off a bit since I don't use Declarative. (My project predates
declarative.)
Well obviously the declarative use case is the focus of the documentation
since that's the standard.
>
> The actual situation I have is that there are three tables, A, B, and C.
B is a child of A and C is a child of both A and B.
>
> A has a_id, B has a_id (a foreign key to A) and b_id (its primary key).
C has a_id and b_id. The catch is that, for each row in C, we require
that a_id match both a row in A and the a_id from the corresponding row in
B. So the ForeignKey to A in the schema is unnecessary, but I still want
to map it.
that's a significantly more esoteric use case than the one where a
Customer has to link to two different Address objects ;). The `C.a_id`
column here is essentially redundant.
> I still think that making the documentation for the foreign_key
parameter (as opposed to just an example) unambiguous would improve the
situation.
I'm guessing that you're referring to the docstring on relationship
itself, so I have updated this to be more modern and to also refer to the
previously mentioned sections in rd0aaaf28c640.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2725#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|