[Cubicweb] RQL / Casts ?

Sylvain Thénault sylvain.thenault at logilab.fr
Wed Oct 13 07:50:19 CEST 2010

On 12 octobre 19:09, Carlos Balderas wrote:
> Hello List!

Hey Carlos! 

> Some body know if there is a way to make a cast in a rql sentence? ( or a
> trick :-) )
> I am trying to make a UNION but I need to cast an element to string.
> e.g.
> (Any *A*,B,C WHERE Y is Entity, Y *isstring1* A, Y isstring2 B, Y isstring3
> C ....)
> (Any *Z*,B,C WHERE Y is Entity, Y *ISNUMBER* Z, Y isstring2 B, Y isstring3
> C, ....)
> And I get an error due A and Z are different types.
> I wanted to ask you first before looking a workaround of this solution.

No, we've unfortunatly no way to do this currently. We need to define type 
cast functions. Starting with a String function for instance :)
See function definitions in logilab.database.__init__, IMO base type cast
functions could live here.
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