Ah, I understand. I had saw the error but didn't understand what it was implying (being new to SA and all). Adding the alias call worked and all is well in my unit tests again. Thanks for the speedy response!
- Eric On Jan 5, 2:57 pm, Michael Bayer <[email protected]> wrote: > the key is this warning: > > SAWarning: mapper Mapper|ApplicationSchedule|Select object creating an > alias for the given selectable - use Class attributes for queries. > > so in this case the polymorphic_on column is no longer recognized > since its against the underlying selectable, which has been replaced. > change your selectable to: > > select_application_schedules = select([table_application_schedules], > table_application_schedules.c.dateDeactivated == None).alias() > > SQLA should be making a better choice here. Either not allow the auto- > alias() thing, or somehow figure out the right thing to do. The > latter is not trivial at the moment. > > On Jan 5, 2009, at 2:06 PM, Eric R. Palakovich Carr wrote: > > > > > Hello. SA newbie here. > > > I'm using selectable in a mapper for the first time and I'm having > > problems. From what I understand, you can create a select object and > > use it in place of a Table object in a mapper. For example, if you > > have these two objects: > > > schedTable = Table('schedule', metadata, Column('id', Integer, > > primary_key=True), Column('aDate', Date)) > > schedSelect = select([schedTable]) > > > The following two mapper lines will result in a ScheduleClass that > > works exactly the same as the other: > > > mapper(ScheduleClass, schedTable) > > mapper(ScheduleClass, schedSelect) > > > Following this logic, I tried to update one of my mappings with a > > select object and received errors. To see what happened, I've wrote > > some simplified code that reproduces the problem and pasted it here: > > >http://pastebin.com/d5467be2f > > > When you run the code it succesfully creates the mapper and even > > inserts new objects correctly into the database, but when trying to > > retrieve data it throws the following error: > > > sqlalchemy.exc.NoSuchColumnError: "Could not locate column in row for > > column 'scheduleType'" > > > at the following line of code: > > > schedules = session.query(ApplicationSchedule).all() > > > What am I doing wrong / don't understand about SQLAlchemy? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
