Re: [SQLObject] Table with pointer to itself
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Kevin D. <da...@gm...> - 2005-07-17 13:43:30
|
On 7/17/05, Thanos Tsouanas <th...@si...> wrote: > class Forum(sqlobject.SQLObject): > # Columns > title =3D sqlobject.UnicodeCol(notNone=3DTrue) > prec =3D sqlobject.FloatCol(default=3DNone) > rlevel =3D sqlobject.FloatCol(default=3D0.0) > wlevel =3D sqlobject.FloatCol(default=3D1.0) > # Foreign keys > board =3D sqlobject.ForeignKey("Board") > parent =3D sqlobject.ForeignKey("Forum") I believe that this will implicitly create a column called "parent_id". > # 1-M Relations > threads =3D sqlobject.MultipleJoin('Thread', joinColumn=3D'forum', > orderBy=3D'updated') > children =3D sqlobject.MultipleJoin('Forum', joinColumn=3D'parent', > orderBy=3D'prec') ...and that's why specifying a joinColumn of "parent" won't work here. > # M-M Relations > moderators =3D sqlobject.RelatedJoin('User') Kevin |