[kforge-dev] using SQLObject :-)

John Bywater john.bywater at appropriatesoftwarefoundation.org
Fri May 6 20:28:32 UTC 2005


So after reading the source and learning about an undocumented 
attribute, I got SQLObject working with the users table of the gforge 
database.

I needed:

(1) to override the 'user' class name for table name 'users' (would have 
been: 'user'),

(2) override the primary key name for column name 'user_id' (would have 
been 'id'),

(3) [missing piece] override the sequence name for the sequence 
'user_pk_seq' (was 'users_user_id_seq').

The sqlobject.SQLObject attributes required to do this are:

class User(SQLObject):
    _table = 'users'
    _idName = 'user_id'
    _idSequence = 'users_pk_seq'


I learnt about the _idSequence attribute by reading the Python 
'sqlobject' modules source code.

This attribute isn't mentioned in the SQLObject manual.

Point being, that my confidence in basing an interface to the Gforge 
database on SQLObject is restored!

:-)

Regards,

John.






More information about the kforge-dev mailing list