On Wed, Mar 31, 2010 at 08:37:32AM +0800, Jason Heeris wrote:
> my_selection = dbase.Stock.select(
> sqlobject.sqlbuilder.AND(
> dbase.Stock.q.dbStockCode.startswith("XXX"),
> sqlobject.sqlbuilder.NOTIN(
> sqlobject.sqlbuilder.Outer(dbase.Stock).q.id,
>
> sqlobject.sqlbuilder.Select(dbase.ContItem.q.dbStock)))
>
> ... gives exactly the same error though.
The following code
from sqlobject import *
from sqlobject.sqlbuilder import *
__connection__ = "sqlite:/:memory:?debug=1"
class Stock(SQLObject) :
dbStockCode = StringCol()
class ContItem(SQLObject) :
dbStock = ForeignKey('Stock')
dbQuantity = IntCol()
Stock.createTable()
ContItem.createTable()
print list(Stock.select(
AND(Stock.q.dbStockCode.startswith("XXX"),
NOTIN(Outer(Stock).q.id,
Select(ContItem.q.dbStock)))))
works for me; the query is
3/QueryR : SELECT stock.id, stock.db_stock_code FROM stock WHERE
((stock.db_stock_code LIKE ('XXX%') ESCAPE '\') AND (stock.id NOT IN (SELECT
cont_item.db_stock_id FROM cont_item)))
Oleg.
--
Oleg Broytman http://phd.pp.ru/ [email protected]
Programmers don't die, they just GOSUB without RETURN.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss