what you are desribing here is very similar to what the SelectResults  
extension does:

from sqlalchemy.ext.selectresults import SelectResultsExt
mapper(Invasive, invasives_table, extension = SelectResultsExt)

invasive_objects = query_invasive.select(conditions,  
order_by=order_by).offset(offset).limit(limit)

# run the query
invasive_objects = list(invasive_objects)

SelectResults can be used on a per-query basis, without using the  
mapper extension,  like this:

from sqlalchemy.ext.selectresults import SelectResults
query = SelectResults(session.query(Invasives), criterion)

On Jun 19, 2006, at 9:07 AM, Julien Cigar wrote:

> Hello !
>
> All is in the subject :) How could I make subselects from a mapper ?
>
> Currently I have :
> session = create_session()
> query_invasive = session.query(Invasive)
> invasive_objects = query_invasive.select(conditions,  
> order_by=order_by,
> limit=limit, offset=offset)
>
> and I would like something like :
> invasive_objects = query_invasive.select(conditions,
> order_by=order_by).select(limit=limit, offset=offset) ... but this
> syntax doesn't work.
>
> In advance, thanks !
> Julien
>
>
>
>
> _______________________________________________
> Sqlalchemy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to