map to a Select statement like this:
http://www.sqlalchemy.org/docs/
adv_datamapping.myt#adv_datamapping_selects
On Apr 6, 2006, at 7:04 PM, Koen Bok wrote:
I have a relation:
A product can have stockproducts. Stockproducts are a combination
of a product and a stock. The stock 'main' is alway there.
Now I'd like to do:
product_list = Product.mapper.select()
product_list[123].mainstock
The result would be a COUNT of all the orderproducts in the main
stock.
So what the function sql-wise should do is adding a subquery
'(SELECT COUNT(id) FROM stockproducts WHERE product_id=product.id)'.
Is this possible?
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users