[Sqlalchemy-tickets] Issue #3699: BuffferedColumnResultProxy with compiled_cache corrupts result me
Brought to you by:
zzzeek
From: Mike B. <iss...@bi...> - 2016-04-27 16:19:24
|
New issue 3699: BuffferedColumnResultProxy with compiled_cache corrupts result metadata https://bitbucket.org/zzzeek/sqlalchemy/issues/3699/buffferedcolumnresultproxy-with Mike Bayer: ``` #!python from sqlalchemy import create_engine, select, TypeDecorator, String, literal from sqlalchemy.engine import default from sqlalchemy.engine import result class ExcCtx(default.DefaultExecutionContext): def get_result_proxy(self): return result.BufferedColumnResultProxy(self) engine = create_engine("sqlite://") engine.dialect.execution_ctx_cls = ExcCtx class MyType(TypeDecorator): impl = String() def process_result_value(self, value, dialect): return "HI " + value with engine.connect() as conn: stmt = select([literal("THERE", type_=MyType())]) for i in range(2): r = conn.execute(stmt) assert r.scalar() == "HI THERE" with engine.connect() as conn: cache = {} conn = conn.execution_options(compiled_cache=cache) stmt = select([literal("THERE", type_=MyType())]) for i in range(2): r = conn.execute(stmt) assert r.scalar() == "HI THERE" ``` |