我查看了ExecutionContext类下的源sqlalchemy/engine/base.py,它不包含记录的这个方法 postfetch_cols() 。我已经检查了 0.7.7、0.6.9 稳定版本以及 0.8 我是不是很傻并且遗漏了什么?
当我这样做时,还检查了该方法不存在:
from sqlalchemy import *
engine = create_engine('sqlite:///:memory:')
metadata = MetaData(bind=engine)
t = Table('tableName', metadata, Column('a', String), Column('b', Integer) )
t.create()
engine.execute( t.insert(), {'a':'1', 'b':2} )
res = engine.execute(text('select * from tableName'))
res.postfetch_cols() #or res.context.postfetch_cols()
# AttributeError: 'SQLiteExecutionContext' object has no attribute 'postfetch_cols'
sqlalchemy 文档: http ://docs.sqlalchemy.org/en/rel_0_7/core/connections.html?highlight=postfetch_cols#sqlalchemy.engine.base.ResultProxy.postfetch_cols