On Sep 12, 2008, at 4:08 AM, GustaV wrote:
> > The main reason why I wan't to use relations is eagerloading, because > it is the only way, as far as I can see, to retrieve data from DB from > several objects in one request. its not the only way. You load as many kinds of objects from one Query as you want, and you can return them separately or route any JOIN of your choosing into the collection. Its equally possible in 0.5 as well as 0.4. 0.5 would be: TileAlias = aliased(Tile) sess.query(Tile).join((TileAlias, Tile.id > TileAlias.id)).options(contains_eager(Tile.neighbors, alias=TileAlias)) and you can of course get them separately as: sess.query(Tile, TileAlias).join((TileAlias, Tile.id > TileAlias.id)) in 0.4, youd replace the query.join() with query.select_from(join(tiles, tiles_alias, tiles.c.id > tiles_alias.c.id)). > Maybe today that demand doesn't make any sense, but last time I used > DB, it was much more efficient to issue 1 big request rather than 50 > small ones. it does make sense, and its a central tenet of SQLAlchemy. The above methods are all in the docs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
