On Fri, Nov 14, 2008 at 09:08:05AM -0500, Darren Govoni wrote:
> AttributeError: DataRow instance has no attribute 'processRowID'

   This a known problem with Joins - they cannot guess what ForeignKey
points to them. The user is expected to help.

> class DataRow(SQLObject):
>      type = StringCol()
>      data  = BLOBCol(length=2**24)
>      text = UnicodeCol()
>      row = ForeignKey('ProcessRow')
> 
> class ProcessRow(SQLObject):
>      path = StringCol()
>      status = StringCol()
>      data = SingleJoin('DataRow')
> 
> r = ProcessRow(path='here',status='loading')
> datar=DataRow(data=d,type='binary',text='',row=r)

   Either name your ForeignKey to match the table it references:

class DataRow(SQLObject):
      type = StringCol()
      data  = BLOBCol(length=2**24)
      text = UnicodeCol()
      processRow = ForeignKey('ProcessRow')
      ^^^^^^^^^^

 class ProcessRow(SQLObject):
      path = StringCol()
      status = StringCol()
      data = SingleJoin('DataRow')

 r = ProcessRow(path='here',status='loading')
 datar=DataRow(data=d,type='binary',text='',processRow=r)
                                            ^^^^^^^^^^

   or name the column explicitly:

class DataRow(SQLObject):
      type = StringCol()
      data  = BLOBCol(length=2**24)
      text = UnicodeCol()
      row = ForeignKey('ProcessRow', joinColumn='row_id')
                                     ^^^^^^^^^^^^^^^^^^^

 class ProcessRow(SQLObject):
      path = StringCol()
      status = StringCol()
      data = SingleJoin('DataRow')

 r = ProcessRow(path='here',status='loading')
 datar=DataRow(data=d,type='binary',text='',row=r)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to