right that won't work. if you want that pattern, use synonym(): http://docs.sqlalchemy.org/en/rel_0_8/orm/mapper_config.html#id2
usually a hybrid is what's used here but if you really want just the alternate name, synonym will do it. short code examples inline are just fine. On May 6, 2013, at 2:56 PM, Michael Nachtigal <[email protected]> wrote: > I was using "descriptor" as best I could to match its meaning as I understood > it in SQLAlchemy > (http://docs.sqlalchemy.org/ru/latest/glossary.html#term-descriptor), but it > may be wrong. Here's how I could somewhat reproduce the error using your code > (by the way, which is more appropriate for this mailing list, inline or > attached?): > > from sqlalchemy import * > from sqlalchemy.ext.declarative import declarative_base > > Base = declarative_base() > > t = Table('t', Base.metadata, > Column('user_id', Integer, primary_key=True), > Column('data', String) > ) > class A(Base): > __table__ = t > > user_id = t.c.user_id > user_id2 = t.c.user_id #should be another alias for user_id (right?) > > a1 = A() > a1.user_id = 5 > print a1.user_id > print a1.user_id2 > > # At this point, a1.user_id and a1.user_id2 do not evaluate to the same value. > # In my particular case, a1 was a query result/row, and I could refer to any > # of the mapped class attributes to get the value for that field, except the > one > # named the same as the column name > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
