[Cubicweb] RQL: substitution of values for IN predicate

Sylvain Thénault sylvain.thenault at logilab.fr
Mon Nov 29 12:54:54 CET 2010


On 29 novembre 10:35, Alexandre Fayolle wrote:
> Hello

Hi,
 
> Suppose I have something like:
> 
> wanted_values = [u'foo', u'bar', u'baz']
> 
> query = 'Any X WHERE X is Mumble, X name IN %(values)s'
> 
> As far as I understand, there is no way in the current implementation to pass 
> the query as it is now to execute(), with wanted values being part of a 
> dictionary of substitutions passed as the second argument. Therefore I have to 
> do the substitution for the list of values myself. This probably has an impact 
> on the caching of the query on the server side, as such queries have to be 
> reparsed each time. 

Indeed
 
> Am I the only one who would like to be able to::
> 
>  _cw.execute(query, {'values': wanted_values}) 
> 
> in other words should I file a ticket for this?

We could probably deal with this in cubicweb's querier, so yes.

BTW, does anyone know a sql dbapi module handling this?
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org



More information about the Cubicweb mailing list