Dear SQLAlchemists, I'm trying to fetch some specific row attributes from a select statement on a table. So far so good, this shouldn't be a problem... except this table declares some renamed columns, using "key", as:
sa.Column('the_label', sa.String(30), key='label') When I'm inserting rows, the insert statement uses the renamed column ("label"): one_table.insert().execute(id=0,label='oula') But when I'm selecting results and fetch some attributes on a given row, only the original column names remain: one_row = one_table.select().execute().fetchall()[0] print "attr = %s" % one_row .label # error ! print "orig attr = %s" % one_row the_label # ok it works... Is there any way to get the renamed columns on a RowProxy object ? As attachment, a test case: $ python table_with_key.py Keys in row: ['id', 'the_label'] r.the_label: blabla Traceback (most recent call last): File "table_with_key.py", line 25, in ? print "r.label: %s" % r.label # won' work File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line 730, in __getattr__ AttributeError: label Thanks & Cheers Seb -- Sébastien LELONG sebastien.lelong[at]sirloon.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
table_with_key.py
Description: application/python