Hi Anil, The recent 0.4 betas have an all-new MySQL table reflection routine that's being tried out. It's possible that it's not picking up your primary key when it should- could you send in the output of SHOW CREATE TABLE for this table, either on or off list? Also there should be a warning issued if a key is detected but is not registered on the table.
Anil wrote: > > Module entic.controllers.access:74 in _login > << > # select our user > user_q = model.Session.query(model.User) > user = user_q.filter_by(mail=mail) >>> user_q = model.Session.query(model.User) > Module sqlalchemy.orm.scoping:68 in do > Module sqlalchemy.orm.session:642 in query > Module sqlalchemy.orm.mapper:1648 in class_mapper > Module sqlalchemy.orm.mapper:236 in compile > Module sqlalchemy.orm.mapper:251 in _compile_all > Module sqlalchemy.orm.mapper:278 in _do_compile > Module sqlalchemy.orm.mapper:446 in _compile_tables > <class 'sqlalchemy.exceptions.ArgumentError'>: Could not assemble > any primary key columns for mapped table 'User' > > > I have defined a table as such: > user_table = Table("User", metadata, > autoload=True, autoload_with=config['pylons.g'].sa_engine) > > mapper(User, user_table, properties = { > 'alerts': > relation(Alert, cascade="all, delete-orphan", lazy=False), > 'hosts': relation(Host, > cascade="all, delete-orphan", lazy=False) > }) > > I do have a pri key set in the User table (MySQL). > > I tried to explicitly specify a primary_key even with the > autoload=True, but I get other exceptions after this. > > Is this a bug or an incorrect usage? > > Thanks > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---