First, are you using CVS? There's a bug in 0.4 related to this. CVS
will be 0.5 once I package it up.
On Tuesday, October 14, 2003, at 12:58 PM, Brad Bollenbach wrote:
> Hi,
>
> I have a class like this:
>
> class Refund(SQLObject):
> """A transaction where somebody was given some or all of
> their money back for previous Purchase."""
>
> ...[snip overriding of new and a couple class variables]...
>
> transactionID = ForeignKey('Transaction')
> refundedTransactionID = ForeignKey('Transaction')
>
> The first FK pointing to Transaction, represents the transaction that
> took place to do this refund. The second FK, also pointing to
> Transaction (refundedTransactionID), represents the transaction for
> which the refund was done. So, I need to have two FK's pointing to the
> same relation, each one, of course, pointing to a different row in the
> foreign relation (the transaction table.)
>
> When I create the refund table with only one of the ForeignKey()s
> present, it works fine, but if I try to create it (calling
> createTable) with both defined as above, I get:
>
> Traceback (most recent call last):
> File "lib/merchant.py", line 252, in ?
> class Refund(SQLObject):
> File "../SQLObject/SQLObject.py", line 233, in __new__
> File "../SQLObject/SQLObject.py", line 503, in addColumn
> File "../SQLObject/SQLObject.py", line 102, in addNeedSet
> File "../SQLObject/SQLObject.py", line 404, in __new__
> File "../SQLObject/SQLObject.py", line 662, in _init
> File "../SQLObject/DBConnection.py", line 254, in _SO_selectOne
> File "../SQLObject/SQLBuilder.py", line 126, in sqlRepr
> ValueError: Unknown SQL builtin type: <class
> 'SQLObject.SQLObject.MetaSQLObject'> for <class > '__main__.Transaction'>
>
> Is there a known restriction/reason for why I can't have two FK's in A
> that both point to B, or is this a bug?
>
> --
> Brad Bollenbach
> BBnet.ca
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> SourceForge.net hosts over 70,000 Open Source Projects.
> See the people who have HELPED US provide better services:
> Click here: http://sourceforge.net/supporters.php
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
--
Ian Bicking | ia...@co... | http://blog.ianbicking.org
|