[Erp5-dev] using ComplexQuery and choosing proper tables

Romain Courteaud romain at nexedi.com
Tue Nov 4 17:26:28 CET 2008


* Łukasz Nowak [2008-11-04 16:52:27 +0100]:

> Hello,

Hello,

> Take a look at this snippet:
> 
> kw = {}
> from Products.ZSQLCatalog.SQLCatalog import Query,ComplexQuery
> query = ComplexQuery(
>   Query(**{'movement.start_date' : '>=2008/10/10'}),
>   Query(**{'movement.start_date' : '<=2008/10/10'}),
> )
> kw.update(**query.asSQLExpression())
> context.portal_catalog(**kw)

Did you try ?
  
  context.portal_catalog(query=query)

> 
> It raises error:
> 
> Error Type: OperationalError 
> Error Value: (1054, "Unknown column 'movement.start_date' in 'where
> clause': SELECT DISTINCT\n catalog.path, catalog.uid \nFROM\n catalog AS
> catalog \nWHERE \n 1 = 1 \n AND (((catalog.security_uid IN (4, 5, 6, 7,
> 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
> 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
> 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62,
> 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79)) OR
> (((((((catalog.viewable_owner = 'ERP5TypeTestCase'))))))))) AND (1) AND
> (((((((movement.start_date >= '2008/10/10'))))) AND
> (((((movement.start_date <= '2008/10/10')))))))\nLIMIT 1000") 
> 
> I've dig through SQLCatalog product code, but I wasn't able to convince
> portal_catalog to use movement table too in its query. Passing
> from_table_list = 'movement' didn't help me.
> 
> Question: How to force portal_catalog to use more tables using
> Query/ComplexQuery features?
> 
> Regards,
> Luke
> 
> -- 
> Łukasz Nowak IT Specialist email at lnowak.com http://lnowak.com/
> Skype: Shufla jid: shufla at jabster.pl
> ``Use the Source, Luke...''
> 
> _______________________________________________
> Erp5-dev mailing list
> Erp5-dev at erp5.org
> http://mail.nexedi.com/mailman/listinfo/erp5-dev



More information about the Erp5-dev mailing list