- changed status to resolved
column targeting causes unhandled conflicts due to "label is the column" rule
Issue #2591
resolved
from sqlalchemy import *
from sqlalchemy.orm import Session
class MyType(TypeDecorator):
impl = Integer
def process_result_value(self, value, dialect):
return (value,)
metadata = MetaData()
t = Table('user', metadata, Column('id', Integer))
e = create_engine("sqlite://", echo=True)
metadata.create_all(e)
e.execute(t.insert(), {'id':1})
s = Session(e)
row = s.\
query(t.c.id, type_coerce(t.c.id, MyType).label('foo')).\
filter(t.c.id == 1).first()
assert row == (1, (1,)), repr(row)
the incoming fix will break the long-standing rule that "c.label('x')" should target as "c". this isn't a behavior that's being relied upon by the ORM. There may be some users who are running slightly mis-formed select() queries into query.from_statement() who may hit this issue, but at the moment there's no way to target these two columns separately.
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.8.0b1 (automated comment)
- Log in to comment
2484ef34c27f3342e62bd6285bb3668e2c913090