On Apr 21, 2008, at 4:37 AM, Eric Lemoine wrote:
> > Hello > > I'm trying to use the "key" argument in my mapping: > > refugees_table = Table('refugee', > MetaData(config['pylons.g'].sa_unhcr_webgis_engine), > Column('refugee_fid', types.Integer, primary_key=True), > Column('id', types.Float, key='_id'), > autoload=True, > schema='hqmap') > > But I get this Error Traceback when calling mapper(Refugee, > refugees_table): > > Module ?:25 in <module> >>> from unhcr.model.refugees import refugees_table, Refugee > Module ?:47 in <module> >>> mapper(Refugee, refugees_table) > Module sqlalchemy.orm:518 in mapper > :>> return Mapper(class_, local_table, *args, **params) > Module sqlalchemy.orm.mapper:152 in __init__ >>> self._compile_tables() > Module sqlalchemy.orm.mapper:436 in _compile_tables >>> raise exceptions.ArgumentError("Cant resolve column " + str(col)) > <class 'sqlalchemy.exceptions.ArgumentError'>: Cant resolve column > refugee.id > > Any idea? I'd advise upgrading to the most recent 0.4 version since you're apparently on 0.4.0 there. Also, if "id" is a primary key column on the table, you're probably going to need the primary_key=True flag to remain on the Table definition. If you'd like your mapper to have a different idea of what the primary key for this table is, use the primary_key=[cols] argument on mapper(). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---