[Sqlalchemy-tickets] Issue #3248: populate_result_map gets set for select() that's in the VALUES of
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2014-11-11 15:53:07
|
New issue 3248: populate_result_map gets set for select() that's in the VALUES of an insert() https://bitbucket.org/zzzeek/sqlalchemy/issue/3248/populate_result_map-gets-set-for-select Mike Bayer: ``` #!python from sqlalchemy import * class MyType(TypeDecorator): impl = Integer def process_result_value(self, value, dialect): raise Exception("I have not been selected") m1 = MetaData() t1 = Table('t1', m1, Column('x', MyType()) ) t2 = Table('t2', m1, Column('x', Integer) ) e = create_engine("postgresql://scott:tiger@localhost/test", echo='debug') m1.drop_all(e) m1.create_all(e) e.execute(t1.insert().values(x=5)) stmt = t2.insert().values(x=select([t1.c.x]).as_scalar()).returning(t2.c.x) result = e.execute(stmt) result.scalar() ``` ``` #! Traceback (most recent call last): File "test2.py", line 27, in <module> result.scalar() File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/result.py", line 888, in scalar return row[0] File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/result.py", line 90, in __getitem__ return processor(self._row[index]) File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/type_api.py", line 915, in process return process_value(value, dialect) File "test2.py", line 7, in process_result_value raise Exception("I have not been selected") Exception: I have not been selected ``` |