Hello, The problem I'm seeing is illustrated by the code below. I tried a workaround using TypeDecorator with process_result_value returning a tuple rather than a list, to no avail.
Any help will be greatly appreciated. Regards. Traceback : Traceback (most recent call last): File "satest2.py", line 23, in <module> session.query(Foo, 'col').from_statement("SELECT 55 AS foo_bar, '{1,2,3}'::integer[] AS col;").first() File "/home/user/programs/env/lib/python2.6/site-packages/sqlalchemy/ orm/query.py", line 1494, in first ret = list(self)[0:1] File "/home/user/programs/env/lib/python2.6/site-packages/sqlalchemy/ orm/query.py", line 1682, in instances rows = filter(rows) File "/home/jdemoor/programs/km/lib/python2.6/site-packages/ sqlalchemy/util.py", line 1193, in unique_list return [x for x in seq if x not in seen and not seen.add(x)] TypeError: unhashable type: 'list' Full code : import os from sqlalchemy import create_engine, Table, Integer, MetaData, Column from sqlalchemy.orm import create_session, mapper sa_engine = create_engine(os.environ['TEST_DSN']) session = create_session(sa_engine, autoflush=True, expire_on_commit=True, autocommit=False) metadata = MetaData() foo = Table('foo', metadata, Column('bar', Integer, primary_key=True)) class Foo(object): pass mapper(Foo, foo) # This works assert session.query('col').from_statement("SELECT 'abc' AS col;").first() == ('abc',) assert session.query('col').from_statement("SELECT '{1,2,3}'::integer[] AS col;").first() == ([1,2,3],) assert session.query('col1', 'col2').from_statement("SELECT '{1,2,3}'::integer[] AS col1, 'abc' AS col2;").first() == ([1,2,3], 'abc') foo_obj = session.query(Foo).from_statement("SELECT 1 AS foo_bar;").first() assert foo_obj.bar == 1 try: # This fails session.query(Foo, 'col').from_statement("SELECT 55 AS foo_bar, '{1,2,3}'::integer[] AS col;").first() except TypeError, e: print e from sqlalchemy.dialects.postgresql.base import ARRAY col = Column('col', ARRAY(Integer, mutable=False)) try: # This fails too session.query(Foo, col).from_statement("SELECT 55 AS foo_bar, '{1,2,3}'::integer[] AS col;").first() except TypeError, e: print e -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.