On Mon, 2 Oct 2006, Dennis wrote:

> The "IN" comparison functionality only works if I pass the data in
> without a list.
>
> Examples:
> (broken)
> >>> sel=select([categories.c.id],categories.c.parent_id.in_ ( [1,34] ))
> >>> str(sel)
> 'SELECT categories.id \nFROM categories \nWHERE categories.parent_id =
> %(categories_parent_id)s'
>
> (working)
> >>> sel=select([categories.c.id],categories.c.parent_id.in_(1,34))
> >>> str(sel)
> 'SELECT categories.id \nFROM categories \nWHERE categories.parent_id IN
> (%(categories_parent_id)s, %(categories_parent__1)s)

Hm I was just playing with in_([]), it sort of works for me, but the
integers is not cast to smallint in my case ( postgres specific problem ).

sqlalchemy.exceptions.SQLError: (ProgrammingError) operator does not exist: 
smallint = integer[]
HINT:  No operator matches the given name and argument type(s). You may need to 
add explicit type casts.
  'SELECT attribute.default_value AS attribute_default_value,
attribute.mandatory AS attribute_mandatory, attribute.name AS
attribute_name, attribute.attribute_id AS attribute_attribute_id,
attribute.category_id AS attribute_category_id, attribute.type AS
attribute_type \nFROM attribute \nWHERE attribute.attribute_id =
%(attribute_attribute_id)s ORDER BY attribute.attribute_id'
{'attribute_attribute_id': [33, 34]

/Khaled Daham
Cell:    +46-70-1810278
FreeBSD: The Power to Serve! http://www.FreeBSD.org/
This isn't rocket science -- but it _is_ computer science.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to