The MultipleJoin constructor allows the specification
of a keyword argument 'joinColumn' to specify an
alternate name for the column that holds the Foreign
Key that the join is based upon. Using SQLObject 0.6.1,
this kwarg doesn't seem to work completely correctly.
Attached is a variant on the Address/Person example
that is used in the documentation to demonstrate
MultipleJoins. In addition to the 'addresses'
MultipleJoin, which uses the default foreign key naming
scheme, it adds storage for mailmen; each address has a
single mailman (as a foreign key); Person has a
multiple join over mailmen, returned as
'deliveryLocations'. 'deliveryLocations' uses a
non-default name for the Foreign Key, so the joinColumn
kwarg is required.
As attached, the code does not work; SQLObject
complains that there is 'no such column: mailman'.
Uncomment line 25, comment out line 28, re-run, and the
example works. The fix to the example adds _id to the
specified joinColumn. Although easy to do, this really
shouldn't be required. It can be implied by the fact
that the column name must be a foreign key, and is
inconsistent with naming of foreign key columns
elsewhere (e.g., in select statements). At the very
least, the reference docs should be updated to reflect
Log in to post a comment.