Re: [SQLObject] One to 'a lot' relationship
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Robert L. <ro...@le...> - 2004-08-29 02:20:20
|
(oops, did not send to the list, apologies for the direct email Ian) Ian Bicking wrote: > > SVN is significantly better, though I actually thought 0.5.2 also did > this properly. Anyway, it's supposed to fetch all the columns on any > select. > > There's no database changes necessary to upgrade, but the main module > has changed names from SQLObject to sqlobject, and MyClass(id) is now > MyClass.get(id), and MyClass.new(**kw) is now MyClass(**kw). > To add to the list of changes: The connection logic is deprecated, e.g. you now need to use : from sqlobject.postgres import builder; PostgresConnection = builder(); conn = PostgresConnection(...) or connectionForURI("postgres://...") I'm using the former as I can't seem to get the latter to work atm. The names of the MultipleJoin properties now have an 's' appended to them (I'm not sure if they are fully pluralised, i.e. is address now addresses?). Also the capitalisation seems to have changed so that for a joined table ABCUnit the property is now aBCUnits instead of the old abcUnit - this seems a little counter intuitive, is it possible to revert back or select the old naming scheme in some way. In addition the rev206 SVN release still issues individual selects for every row in the joined table, e.g. It will issue : SELECT id FROM address WHERE person_id = 299 and then for every returned id it will issue: SELECT * FROM address WHERE id = 488 ... (3500 times) where * is the name of every column in the address table. The culprit seems to be class FileConnection(DBConnection): ... def _SO_selectJoin(self, soClass, column, value): results = [] # @@: seems lame I need to do this... value = int(value) for id in self._allIDs(soClass._table): d = self._fetchDict(soClass._table, id) if d[column] == value: results.append((id,)) return results which overrides the default _SO_selectJoin in DBConnection. Am I doing something wrong? Robert |